30.12.20

c program to the largest of three numbers

#include<stdio.h>

int main()

{

 int a,b,c;

printf("Enter three numbers");

scanf("%d%d%d",&a,&b,&c);

if(a>b)

{

if(a>b)

printf("%d is largest number",a);

else

printf("%d is largest number",c);

}

else

{

if(b>c)

printf("%d is the largest number",b);

else

printf("%d is the largest number",c);

}

return 0;

}

OUTPUT

enter three numbers 10 20 30

30 is the largest number

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...