Showing posts with label Maximum. Show all posts
Showing posts with label Maximum. Show all posts

Write a C program to find maximum or equal between two numbers ?

How to Write a C program to find maximum or equal between two numbers ?


  1. /*Write a C program to find maximum or equal between two numbers */
  2.  
  3.  
  4. #include <stdio.h>
  5.  
  6. int main ()
  7.  
  8. {
  9.     int a,b;
  10.     printf("Find the maximum between two number: ");
  11.     scanf("%d %d", &a, &b);
  12.  
  13.     if ( a > b ){
  14.         printf("Minimum Number: %d\n",a);
  15.     }
  16.  
  17.     if ( b > a ){
  18.         printf("Maximum Number: %d\n",b);
  19.     }
  20.  
  21.     if ( a == b ){
  22.         printf("Number is equal");
  23.     }
  24.  
  25.     return 0;
  26. }

How to Write a C program to find maximum between two numbers ?

Write a C program to find maximum between two numbers.



  1. /*Write a C program to find maximum between two numbers */
  2. #include <stdio.h>
  3. int main ()
  4. {
  5.     int a,b;
  6.     printf("Find the maximum between two number: ");
  7.     scanf("%d %d", &a, &b);
  8.     if ( a < b ){
  9.         printf("Minimum Number:%d\n",a);
  10.     }
  11.     if ( a > b ){
  12.         printf("Maximum Number%d\n",b);
  13.     }
  14.     return 0;
  15. }

Write a C program to find maximum between three numbers ?

Write a C program to find maximum between three numbers.

  1. /*Write a C program to find maximum between three numbers */
  2. #include<stdio.h>
  3. int main ()
  4. {
  5.     int a, b, c, max;
  6.     printf("find maximum between three numbers: ");
  7.     scanf("%d %d %d", &a, &b, &c);
  8.     if( a > b){
  9.         max = a;
  10.     }
  11.     if( b > a){
  12.         max = b;
  13.     }
  14.     if( b > c){
  15.         max = b;
  16.     }
  17.     if( c > a){
  18.         max = c;
  19.     }
  20.    if( a > c ){
  21.        max = a;
  22.    }
  23.    if ( c > b){
  24.     max = c;
  25.    }
  26.    printf("The maximum number is: %d\n", max);
  27.     return 0;
  28. }