Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. //zad1
  7.  
  8. /* int a;
  9. int b;
  10. int c;
  11. int suma;
  12.  
  13. printf("Podaj a: \n");
  14. scanf("%d", &a);
  15.  
  16. printf("Podaj b: \n");
  17. scanf("%d", &b);
  18.  
  19. printf("Podaj c: \n");
  20. scanf("%d", &c);
  21.  
  22. printf("a = %d\n", a);
  23. printf("b = %d\n", b);
  24. printf("c = %d\n", c);
  25.  
  26. if (a > b && b > c) {
  27. suma = a + c;
  28. printf("suma = a + c\n");
  29. } else if (a > b && b < c) {
  30. suma = a + b;
  31. printf("suma = a + c\n");
  32. } else {
  33. suma = b + c;
  34. printf("Suma = c + b\n");
  35. }
  36.  
  37. printf("Suma = %d\n", suma); */
  38.  
  39. //zad3
  40.  
  41. /* char x[50];
  42. char z[50];
  43.  
  44. printf("Podaj pierwszy napis: \n");
  45. gets(x);
  46. printf("Podaj drugi napis: \n");
  47. gets(z);
  48.  
  49. printf("Pierwszy napis: %s\n", x);
  50. printf("Drugi napis: %s\n", z);
  51.  
  52. if (strlen(x) > strlen(z)) {
  53. printf("Dłuższy jest napis: %s\n", x);
  54. } else {
  55. printf("Dłuższy jest napis: %s\n", z);
  56. } */
  57.  
  58. //zad4
  59.  
  60. int a;
  61. int b;
  62. int c;
  63. int csq;
  64. int tmp;
  65. int p;
  66.  
  67. printf("Podaj a: \n");
  68. scanf("%d\n", &a);
  69.  
  70. printf("Podaj b: \n");
  71. scanf("%d\n", &b);
  72.  
  73. printf("Podaj c: \n");
  74. scanf("%d\n", &c);
  75.  
  76. tmp = (a * a + b * b);
  77. csq = c * c;
  78.  
  79. printf("A = %d\nB = %d\nC = %d\n", a, b, c);
  80.  
  81. if (tmp == csq) {
  82. printf("Podane boki mogą być bokami trójkąta prostokątnego\n");
  83. p = a * b / 2;
  84. printf("Jego pole jest równe: %d", p);
  85. } else {
  86. printf("Podane boki nie spełniają wymagań");
  87. }
  88.  
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement