Question #28241

Using an if-else statement, kindly HELP write down a C code that will assign the maximum of a and b to an integer variable called Max

Expert's answer

#include<stdio.h>

int main()
{
printf("Input a : ");
int a;
scanf("%d",&a);
printf("Input b : ");
int b;
scanf("%d",&b);

int max;
if(a > b)
& max = a;
else
& max = b;

printf("max = %d",max);&
return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS