Advertisement
YouKnowWho07

If, else if

Dec 1st, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int num1, num2, num3;
  6. printf("Enter three numbers: ");
  7. scanf("%d %d %d", &num1, &num2, &num3);
  8.  
  9. if (num1 >= num2 && num1 >= num3)
  10. {
  11. printf("Maximum number is: %d\n", num1);
  12. }
  13. else if (num2 >= num1 && num2 >= num3) {
  14. printf("Maximum number is: %d\n", num2);
  15. }
  16. else {
  17. printf("Maximum number is: %d\n", num3);
  18. }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement