answersLogoWhite

0


Best Answer

Using if-else statement

#include<stdio.h>

#include<conio.h>

int main(void)

{

long int n,i;

clrscr();

printf("\n Enter any two nos.");

scanf("%ld%ld",&n,&i);

if(n>i)

printf("\nThe largest no. is=%ld",n);

else

printf("\nthe largest no. is=%ld",i);

getch();

return 0;

}

using ternary operator

#include<stdio.h>

#include<conio.h>

int main(void)

{

int n,i,a;

clrscr();

printf("\n Enter any two nos.");

scanf("%d%d",&n,&i);

a=(n>i?n:i);

printf("\nThe largest no. is=%d",a);

getch();

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: WAP to read any two numbers and display largest of them?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions