C program to find the greatest of three numbers with user input.

#include<stdio.h>


int main()

{

    int num1,num2,num3;


    printf("\nEnter value of num1,num2,num3:");

    scanf("%d %d %d", &num1, &num2 ,&num3);


    if((num1>num2)&&(num1>num3)){

    

        printf("The greatest number is num1\n");

    }

    

    else if((num2>num3)&&(num2>num1)){

    

    

        printf("The greatest number is num2\n");

    }else{

   

        printf("The greatest number is num3\n");

    }

        

    

    return 0;

}




after that when you run this code into your Vs code terminal, you have to give some
input to your program then press "Enter" and you will see the output in your terminal.

Comments

Post a Comment

Popular posts from this blog

How to add to integers in C programming

Check whether a character Vowel or Consonant