Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Tuesday, January 25, 2011

C PROGRAM FOR GREATEST NUMBER

# include<stdio.h>

int main () {

int x,y,z;

printf("ENTER THE THREE NUMBERS\n");

scanf("%d%d%d",&x,&y,&z);

if (x>y && x>z)    // && shows that both conditions have to be true

{ printf("THE NUMBER %d IS THE GREATEST",x); }

if (y>x && y>z)  // && shows that both conditions have to be true

{ printf("THEN NUMBER %d IS THE GREATEST",y); }

if (z>x && z>y)  // && shows that both conditions have to be true

{ printf("THE NUMBER  %d IS THE GREATEST" ,z); }

return 0;
}

No comments:

Post a Comment

Related Posts with Thumbnails