Advertisement
Dido09

C - Largest of Three Numbers

May 23rd, 2022
572
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(){
  5.  
  6. int num1, num2, num3;
  7.  
  8. printf("Enter three integers: ");
  9. scanf("%d %d %d", &num1, &num2, &num3);
  10.  
  11. if(num1 > num2 && num1 > num3)
  12.     printf("%d is the largest", num1);
  13.     else
  14. if(num2 > num1 && num2 > num3)
  15.     printf("%d is the largest", num2);
  16.     else
  17. if(num3 > num1 && num3 > num2)
  18.     printf("%d is the largest", num3);
  19.  
  20. return 0;
  21. }
  22.  
Advertisement
RAW Paste Data Copied
Advertisement