Answers for "to find greatest of 4 numbers in c"

C
1

find the largest number among five numbers in c language

#include<stdio.h> 
 
int main() 
{ 
 int a,b,c,d,e; 
 
 printf("ENTER THE FIVE NUMBERS"); 
 scanf("%d %d %d %d %d",&a,&b,&c,&d,&e); 
 
 if(a>b && a>c &&  a>d && a>e) 
  printf("%d is largest", a); 
 
 else 
  if(b>c && b>d && b>e) 
   printf("%d is largest", b); 
 
 else 
  if(c>d && c>e) 
   printf("%d is largest", c); 
 
 else 
  if(d>e) 
   printf("%d  is largest", d); 
 
 else 
  printf("%d is largest", e); 
  
 return 0; 
}
Posted by: Guest on December-30-2021
0

to find greatest of 4 numbers in c

#include <stdio.h>

int main()
{
    int a, b, c, d;
    printf("enter four numbers:");
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if (a > b)
    {
        if (a > c)
        {
            if (a > d)
            {
                printf("%d is greatest n", a);
            }
        }
    }
    else
    {
        if (b > c)
        {
            if (b > d)
            {
                printf("%d is greatest n", b);
            }
        }
        else
        {
            if (c > d)
            {
                printf("%d is greatest n", c);
            }
            else
            {
                printf("%d is greatest n", d);
            }
        }
    }

    return 0;
}
Posted by: Guest on January-19-2022

Code answers related to "to find greatest of 4 numbers in c"

Code answers related to "C"

Browse Popular Code Answers by Language