//Write a Program using Switch Statement in C
#include<stdio.h>
#include<conio.h>
void
main()
{
int ch;
clrscr();
printf("Enter
Your Choice");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("Today is Sunday");
break;
case 2:
printf("Today is Monday");
break;
case 3:
printf("Today is Tuesday");
break;
case 4:
printf("Today is Wednesday");
break;
case 5:
printf("Today is Thrusday");
break;
case 6:
printf("Today is Friday");
break;
case 7:
printf("Today is Saturday");
break;
default:printf("Please
Enter Your Choice between 1 to 7");
}
getch();
}
|
Output:
#include
ReplyDelete#include
void main()
{
int m,e,c,p,h,sum,per;
printf ("Enter the value of five subject ,m,e,c,p,h.");
scanf("%d%d%d%d%d,&m,&e,&c,&p,&h ");
sum=m+e+c+p+h;
per=sum/5;
if (per<=60)
{
printf (" you got first division.");
}
else
if(per<=50)
{
printf ("you got second division.");
}
else
if (per<=40)
{
printf (" you got third division.");
}
else
{
printf (" fail");
}
getch();
}
Sir ho gya marks vala program