/* program 1 */
/* Student result grad using switch statement. */
#include<stdio.h>
#include<conio.h>
void main()
{
int marks, index;
char str;
printf("Enter the marks: ");
scanf("%d",&marks);
index=marks/10;
switch(index)
{
case 10:
case 9:
strcpy (grade,"A+");
break();
case 8:
strcpy (grade,"A");
break();
case 7:
strcpy (grade,"B");
break();
case 6:
strcpy (grade,"C");
break();
case 5:
strcpy (grade,"D");
break();
case 4:
strcpy (grade,"E");
break();
default:
strcpy (grade,"F");
break();
}
printf("%s \n",grade);
getch();
}
/* program 2 */
/* Menu drive program */
#include<stdio.h>
#include<conio.h>
void main()
{
printf ("Travel Guide \n\n");
printf("A air Timings \n");
printf("T Train Timings \n");
printf("B Bus Timings \n");
printf("X To skip \n");
printf("Enter your choice : ");
character=getchar();
switch(character)
{
case 'A':
air display ();
break();
case'B':
bus display();
break();
case 'T':
train display();
break();
Default:
printf("NO choice");
}
getch();
}
post by arnob
No comments:
Post a Comment