Aaj hum c programming me yesa
program dekhane wale hai jiski help se hum kisi bhi 3 number me se largest
number find kaise kiya jata hai.
Program Logic:
3 variable declare kare jisme hume
3 Number ki value save karani hai, integer, ya float
Koi bhi 3 value ko user se input
karawaye.
If-else is conditional statement ke help
se hume in 3 values ko compare karana hai, jo bhi value large hogi usko display
karana hai.
Is program ko hum use of if-else
conditional statement ke taur par bhi use kar sakate hai.
Write a C program To Find Largest Number between Any 3 Numbers
#include<stdio.h>
#include <conio.h>
void main( )
{
int N1, N2, N3;
Clrscr( );
printf("\n Enter Any Three Numbers= ");
scanf("%d %d %d", &N1, &N2, &N3 ) ;
if(N1 > N2)
{
if(N1 > N3)
{
printf("\n Largest Number is %d", N1);
}
else
{
printf("\n Largest Number is %d", N3);
}
}
else
{
if(N2 > N3)
{
printf("\n Largest Number is %d", N2);
}
else
{
printf("\n Largest Number is %d", N3);
}
}
}
Output:
Enter Any Three Numbers=
20
50
10
Largest Number is
50
Aapka question aur query ko niche
comment me jarur bataye. Humare latest updates ke liye subscribe kare aur
humari website ko bookmark me save kar le.
0 Comments: