C Programming Language Tutorial – Lecture 11 if else

This tutorial explains if-else if-else statement

Lect 10 math.h library

C Playlist

// Source Code

// Greatest of 3 numbers

#include<stdio.h>

int main(){

int a,b,c;

printf("ENter 3 numbers \n");
scanf("%d%d%d",&a,&b,&c);

if(a>b && a>c){
printf("a is greatest and its value is %d",a);
}
else if(b>c){
printf("b is greatest and its value is %d",b);
}
else{
printf("c is greatest and its value is %d",c);
}

return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s