largest of 3 Numbers C program

This program is for finding the largest of 3 numbers without logical gate. This program is part of Mumbai University MCA Colleges C-Programming MCA Sem 1

#include<stdio.h>
#include<conio.h>
void main()
{
            int a,b,c;
            clrscr();
            printf("Please enter 3 numbers a,b,c");
            scanf("%d %d %d",&a,&b,&c);
             if(a>b)
            {
                        if(a>c)
                        {
                                     printf("%d(a) is the greatest",a);
                         }
                        else
                         {
                                    printf("%d(c) is the greatest",c);
                         }
            }
            else if(b>c)
            {
                        if(b>a)
                        {
                                    printf("%d(b) is the greatest",b);
                         }
                        else
                                    printf("%d(a) is the greatest",a);
            }
            else
                         printf("%d(c) is the greatest",c);

            getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment