S2-C-Programs

All major conceptual S2 C-Programs with Algorithms

View the Project on GitHub trulyPranav/S2-C-Programs

Code:

#include<stdio.h>
void main{

  int a,b,c; // Declaring three variables for storing the numbers
  printf("Enter three numbers:");
  scanf("%d%d%d", &a, &b, &c);//Reads three numbers


// For comparing the numbers, we are using Logical AND (&&) operator
  if( (a>b) && (a>c) ) 
  {
    printf("%d is the greatest number.",a);
  }
  else if( (b>a) && (b>c) ){
    printf("%d is the greatest number.",b);
  }
  else{
    printf("%d is the greatest number.",c);
  }

}

Algorithm:

Step 1:Start

Step 2: Read three numbers and store it in a,b,c

Step 3: if( (a>b) && (a>c) )

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

else

Step 4: Stop