Showing posts with label big numbers in c. Show all posts
Showing posts with label big numbers in c. Show all posts

Thursday, February 16, 2017

Largest of Three Numbers in C

In this article I would like to share with you a sample program that I wrote using C as my programming language that will ask the user to give three numbers and then our program will check and determine which of the three numbers is the largest in terms of value using if conditional statement in C.  The code is very easy to understand and use. I am using CodeBlocks as my text editor and Dev C++ as my C/C++ compiler in this sample program. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

#include <stdio.h>

int main()
{
    int a=0,b=0,c=0;

    printf("\n\n");
    printf("LARGEST OF THREE NUMBERS IN C");
    printf("\n\n");
    printf("Give three numbers : ");
    scanf("%d%d%d",&a,&b,&c);
    printf("\n\n");
     if (a>b) {
         if (a>c){
            printf("The Largest Number is %d",a);
         }
         else {
            printf("The Largest Number is %d",c);
         }
     }
         else if (b>c){
            printf("The Largest Number is %d",b);
         }
         else {
            printf("The Largest Number is %d",c);
         }
    printf("\n\n");
    printf("END OF PROGRAM");
    printf("\n\n");
     }