Discussion Forums

New User? Please read instructions!

C program to find largest of given 3 numbers  

  RSS

thiyagarajan
Eminent Member
Joined:10 months  ago
Posts: 26
27/01/2017 9:29 am  

Need C program to find largest of given 3 numbers


ReplyQuote
prakash
Eminent Member
Joined:10 months  ago
Posts: 20
30/01/2017 10:27 am  

Hi, To find largest of given 3 numbers, please use below C program.

 

#include <stdio.h>

int main(){

      float a, b, c;

      printf("\nPlease enter 3 numbers:");

      scanf("%f %f %f", &a, &b, &c);

      if(a>=b && a>=c)

         printf("\nThe largest number is %f", a);

      if(b>=a && b>=c)

         printf("\nThe largest number is %f", b);

      if(c>=a && c>=b)

         printf("\nThe largest number is %f", c);

      return 0;

}

Edited: 10 months  ago

ReplyQuote
  
Working

Please Login or Register






Share this website !!!
Facebook Twitter Linkedin