If Else Control Statements In C
If Else Control Statements In C:
#include<stdio.h>
int main(int argc, char const *argv[])
{
/* int age;
printf(" hello ");
printf(" enter your age\n");
scanf(" %d", &age);
printf(" you have enterd yoour age is %d \n", age);
if (age>18)
{
printf(" you can vote");
}
else if (age>=10)
{
printf(" you can vote for babies");
}
else
{
printf(" you can note vote");
}
*/
int ch;
printf(" enter any alpabat\n");
scanf("%d",&ch);
if (ch=='a',ch=='i',ch='e',ch=='o',ch=='u')
{
printf("vovel");
}
else
{
printf("consonant");
}
return 0;
}
second
#include<stdio.h>
int main(int argc, char const *argv[])
{ int maths , science;
printf(" hello i am rishabh\n");
printf(" enter maths mark\n");
scanf(" %d",&maths);
printf(" enter your science mark\n");
scanf(" %d",&science );
if (maths>=33 ,science>=33)
{
printf(" you can recive 45 rupay gift");
}
else if (maths>=33)
{
printf(" you can win 15 rupay gift");
}
else if (science>=33)
{
printf(" you can win 15 ruoay gift");
}
else
{
printf(" better luck nest time");
}
return 0;
}
Comments
Post a Comment