Write a program that reads and prints the biggest of 2 numbers.
Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>
void main()
{
int i,j,big; //variable declaration
scanf("%d%d",&i,&j);
big = i;
if(big < j)
{
big = j;
}
printf("biggest of two numbers is %d \n",big);
if(i < j)
{
big = j;
}
else
{
big = i;
}
printf("biggest of two numbers (using else) is %d \n",big);
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Maximum value of n integers using Max function