Advertisement
STANAANDREY

PC3

Oct 5th, 2022
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. float x, y;
  5. printf("x="); scanf("%f", &x);
  6. printf("y="); scanf("%f", &y);
  7.  
  8. puts("1)max dintre x si y");
  9. puts("2)min dintre x si y");
  10. puts("3)x");
  11. puts("4)y");
  12. int opt;
  13. printf("option="); scanf("%d", &opt);
  14.  
  15. if (opt == 1) {
  16. if (x > y) {
  17. printf("%f", x);
  18. } else {
  19. printf("%f", y);
  20. }
  21. } else if (opt == 2) {
  22. if (x > y) {
  23. printf("%f", y);
  24. } else {
  25. printf("%f", x);
  26. }
  27. } else if (opt == 3) {
  28. printf("%f", x);
  29. } else if (opt == 4){
  30. printf("%f", y);
  31. }
  32. puts("");
  33.  
  34. return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement