Skip to main content
C Program to print the largest number without using if else statement
#include<stdio.h>
int main()
{
int firstnum,secondnum;
printf("Enter the first number\n");
scanf("%d",&firstnum);
printf("Enter the second number\n");
scanf("%d",&secondnum);
int largest_number=firstnum>secondnum?firstnum:secondnum;
printf("%d is the largest",largest_number);
}
Output:
Comments
Post a Comment