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 SUM

#include<stdio.h>
int main() {



int x,y,z;

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

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

if ( (x+y>x+z)  &&  (x+y>y+z)   )

{ printf("THE SUM ie %d OF %d AND %d IS GREATEST\n",x+y,x,y); }

if ( (y+z>x+y)  &&   (y+z>x+z)  )

{ printf("THE  SUM ie %d OF %d AND %d IS GREATEST\n",y+z,y,z); }

if( (z+x>x+y )  &&    (z+x>y+z) )

{ printf("THE SUM IS %d OF %d AND %d IS GREATEST\n",z+x,z,x); }

return 0;
}

No comments:

Post a Comment

Related Posts with Thumbnails