Use if-else statement, write down a C code to assign the maximum of a and b to an integer variable called Max.
1
Expert's answer
2013-04-15T11:26:24-0400
//main function int main() { int a,b;//variable a and b printf("Enter number a: ");//Enter number a scanf("%d",&a); printf("Enter number b: ");//Enter number b scanf("%d",&b); //show result if(a>b){ printf("Max is a = %d",a); }else{ printf("Max is b= %d",b); } scanf("%d",&a);//delay return 0; }
Comments
Leave a comment