Here you will find a variety of videos on technology, Tutorials, News, Tip And Tricks, Reviews

Breaking

Post Top Ad

Your Ad Spot

Tuesday, June 2, 2015

To find the greater among three numbers with an algorithm , flowchart and program.



Algorithm:


Step 1: Start


Step 2: Input value of a,b,c


Step 3: If a > b then


                     Assign a to max

             Otherwise

                     Assign b to max
 
Step 4: If c > maximum then

 
                     Assign c to max


Step 5: Display max


Step 6: Stop



Flowchart:


Program: 



#include<stdio.h>

int main()


{

   int a,b,c,max;


   printf("\n Enter three numbers ");

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

   if(a>b)


    {
   
          max=a;
    }

   else

   {
  
         max=b;
   } 

   if(c>max)

   {
        
         max=c;
   }


   printf("\n greater number is %d \n", max);
 
   return (0);


}



Output:


 
Enter three numbers 2 3 4
 
greater number is 4



Post Top Ad

Your Ad Spot

Pages