Wellcome To Programming With Coding.Have You Any Querie? Let Us To Know.

Write a program in C to find the greatest among three integers without using 3rd variable.

 



We must followđź‘€ given steps to find the greatest among three integers without using 3rd variable.  

#include<stdio.h>
int main(){
     int num1,num2,num3;
     printf("enter your first value :\n");
     scanf("%d",&num1);
     printf("enter your second value :\n");
     scanf("%d",&num2);
     printf("enter your third value :\n");
     scanf("%d",&num3);
     if(num1>num2){
         if(num1>num3){
             printf("%d is biggest value among the three values ",num1);


         }
         else{
             printf("%d is biggest value among the three values ",num3);

         }
     }
     else if(num2>num1){
         if(num2>num3){
             printf("%d is biggest value among the three values ",num2);


         }
         else{
             printf("%d is biggest value among the three values ",num3);

         }
     }

     return 0;
}









Post a Comment

0 Comments