Conditional Programming in C

 C Program to find greatest among two numbers.
```#include<stdio.h >
int main( ){
int a, b;
printf("Enter Values for A : ");
scanf("%d",&a);
printf("Enter Values for B : ");
scanf("%d",&b);
if(a>b) {
printf("A is Greatest\n") ;
}
else {
printf("B is Greatest\n");
}
return 0;
}```
OUTPUT :
```Enter Values for A : 62
Enter Values for B : 119
B is Greatest```
 C Program to find greatest among three numbers.
```#include< stdio.h >
int main( ){
int a, b, c;
printf("Enter Values for A,B & C : ");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c) {
printf("A is Greatest\n") ;
}
else if(b>c){
printf("B is Greatest\n");
}
else {
printf("C is Greatest\n");
}
return 0;
}```
OUTPUT :
```Enter Values for A,B & C :
52 43 66
C is Greatest```
 C Program to find greatest among three numbers using Nested If-else. without using third variable
```#include<<stdio.h >
int main( ){
int a, b,c;
printf("Enter Values for A,B & C : ");
scanf("%d%d%d",&a,&b,&c);
if(a>b) {
if(a>c)
printf("A is Greatest\n") ;
else
printf("C is Greatest\n") ;
}
else {
if(b>c)
printf("B is Greatest\n") ;
else
printf("C is Greatest\n") ;
}
return 0;
}```
OUTPUT :
```Enter Values for A,B & C :
52 43 66
C is Greatest```
 C Program to check the given number is even or odd.
```#include< stdio.h >
int main( ) {
int a;
printf("Enter Values for A : ");
scanf("%d",&a);
if(a%2 == 0) {
printf("%d is EVEN NUMBER\n",a) ;
}
else {
printf("%d is ODD NUMBER\n",a);
}
return 0;
}```
OUTPUT :
```Enter Values for A : 18
18 is EVEN NUMBER```
 C Program to check the alphabet is vowel or not.
```int main( ) {
int a, b,c;
printf("Enter Values for A : ");
scanf("%c",&a);
if(a=='a'||a=='e'||a=='I'||a='o'||a=='u') {
printf("Character is VOWEL\n");
}
else if(a=='A'||a=='E'||a=='I'||a='O'||a=='U') {
printf("Character is VOWEL\n");
}
else {
printf("Character is NOT VOWEL\n");
}
return 0;
}```
OUTPUT :
```Enter Values for A : x
Character is NOT VOWEL```
 C Program to ask user to enter marks of 5 subjects and calculate percentage then print GRADE according to marks in percentage.
```int main( ) {
int m1,m2,m3,m4,m5;
float per;
printf("Enter Marks Subject 1: ");
scanf("%d",&m1);
printf("Enter Marks Subject 2: ");
scanf("%d",&m2);
printf("Enter Marks Subject 3: ");
scanf("%d",&m3);
printf("Enter Marks Subject 4: ");
scanf("%d",&m4);
printf("Enter Marks Subject 5: ");
scanf("%d",&m5);
per = (m1+m2+m3+m4+m5)/5.0f;
if(per>=70){
}
else if(per>=60){
}
else if(per>=50){
}
else if(per>=40){
}
else{
}
return 0;
}```
OUTPUT :
```Enter Marks Subject 1: 55
Enter Marks Subject 2: 67
Enter Marks Subject 3: 50
Enter Marks Subject 4: 68
Enter Marks Subject 5: 78

 C Program to print DAY according to user input for day count.
```#include<stdio.h >
int main( ) {
int i;
printf("Enter Day Number : ");
scanf("%d",&i);
switch(i) {
case 1:
printf("DAY IS MONDAY\n");
break;
case 2:
printf("DAY IS TUESDAY\n");
break;
case 3:
printf("DAY IS WEDNESDAY\n");
break;
case 4:
printf("DAY IS THURSDAY\n");
break;
case 5:
printf("DAY IS FRIDAY\n");
break;
case 6:
printf("DAY IS SATURDAY\n");
break;
case 7:
printf("DAY IS SUNDAY\n");
break;
default:
printf("WRONG CHOICE \n");
}
return 0;
}```
OUTPUT :
```Enter Day Number : 3
DAY IS WENESDAY

Enter Day Number : 9
WRONG CHOICE```

#### CONTACT DETAILS

info@prowessapps.in
(8AM to 10PM):

+91-8527238801 , +91-9451396824