Thursday, 22 March 2018

Program to find greater no. out of 3

Program is simply created to find out the greatest  no.  out of three using C language.
so, here the code for the same.

/*Pre-Processor used throughout the program*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

void main()
{
        int a,b,c;
        clrscr();
        printf("\nEnter first element:- ");
        scanf("%d",&a);
   
        printf("\nEnter second element:- ");
        scanf("%d",&b);

        printf("\nEnter third element:- ");
        scanf("%d",&c);

        if(a>b&&a>c)
        {
                  printf("%d is greater among all of them",a);
         }
   
          if(b>c&&b>a)
          {
                  printf("%d is greater among all of them",b);
           }
     
           if(c>b&&c>a)
           {
                   printf("%d is greater among all of them",c);
            }
            getch();
}


No comments:

Post a Comment