Q:

C Program to Find Largest of Three Numbers Using Function

belongs to collection: Function Programs in C

0

C Program to Find Largest of Three Numbers Using Function

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Algorithm -:

  1. Program Start
  2. Variable Declaration (int a,b,c,l)
  3. Input number from the user
  4. Calling Function to find Largest Numbers among Three number
  5. Check the condition
  6. Display answer according the condition
  7. Program End

Program To Find Largest of Three Numbers Using Function

//C program to find the Largest of three numbers Using Function

#include<stdio.h>
int larg(int, int, int);
int main()
{
  // Variable declaration
   int a,b,c, l;

   printf("Enter Three Number\n");
   scanf("%d %d %d",&a,&b,&c);

   //calling function to find Largest number
   l = larg(a,b,c);

 //Display Largest number
    printf("Largest Number is : %d",l);

   return 0;
}
int larg(int a, int b, int c)
{  int larg;
     // Larg among a, b and c
  if(a>b)
  {
      if(a>c)
        larg = a;
      else
        larg = c;
  }
  else
  {
      if(b>c)
        larg = b;
      else
        larg = c;
  }

}

Output -:

Enter Three Numbers
10
19
13

Largest Number is : 19

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
<< C Program To Find Prime Number Using Function...