Vehicle type Month of sales Price(Rs)
Maruthi-800 02/87 75,000
Maruthi-van 07/87 95,000
Maruthi-DX 04/88 1,10,000
Gypsy 08/88 85,000
Write a c program to read this data in to a table of strings and o/p the details of particular vehicle sold during a specified period the program should request the user to input the vehicle type and the period.(starting month and ending month)
Algorithm:
Step 1: Start
Step 2: Enter your choice
Step 3: Read ch value
Step 4: if ch =1 then
4.1 printf "Month of sales is : 02/87”
4.2 printf "Price is : 75,000"
Step 5: if ch =2 then
5.1 print "Month of sales is : 07/87 "
5.2 print "Price is : 95,000”
step 6: if ch=3 then
6.1 print "Month of sales is : 04/88 "
6.2 print " Price is : 1,10,000"
Step 7:
7.1 print "Month of sales is : 08/88 "
7.2 print " Price is : 85,000"
Step 8 : end
Program:
Program for record maintenance of maruthi car dealer */
#include<stdio.h>
main()
{
int ch;
while(1)
{
clrscr();
printf("Menu\n1.Maruthi-800\n2.Maruthi-van\n3.Maruthi-DX\n4.Gypsy\n5.Exit");
printf("\nEnter your choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1:
{
printf("Month of sales is : 02/87");
printf("\nPrice is : 75,000");
break;
}
case 2:
{
printf("\nMonth of sales is : 07/87 ");
printf("\nPrice is : 95,000");
break;
}
case 3:
{
printf("\nMonth of sales is : 04/88 ");
printf("\n Price is : 1,10,000");
break;
}
case 4:
{
printf("\nMonth of sales is : 08/88 ");
printf("\n Price is : 85,000");
break;
}
case 5:
{
exit();
}
default:
printf("\nInvalid choice");
}
getch();
}
}
Output:
Menu
1.Maruthi-800
2.Maruthi-van
3.Maruthi-DX
4.Gypsy
5.Exit
Enter your choice : 1
Month of sales is : 02/87"
Price is : 75,000
Menu
1.Maruthi-800
2.Maruthi-van
3.Maruthi-DX
4.Gypsy
5.Exit
Enter your choice : 5
1 comment: