Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- //zad1
- /* int a;
- int b;
- int c;
- int suma;
- printf("Podaj a: \n");
- scanf("%d", &a);
- printf("Podaj b: \n");
- scanf("%d", &b);
- printf("Podaj c: \n");
- scanf("%d", &c);
- printf("a = %d\n", a);
- printf("b = %d\n", b);
- printf("c = %d\n", c);
- if (a > b && b > c) {
- suma = a + c;
- printf("suma = a + c\n");
- } else if (a > b && b < c) {
- suma = a + b;
- printf("suma = a + c\n");
- } else {
- suma = b + c;
- printf("Suma = c + b\n");
- }
- printf("Suma = %d\n", suma); */
- //zad3
- /* char x[50];
- char z[50];
- printf("Podaj pierwszy napis: \n");
- gets(x);
- printf("Podaj drugi napis: \n");
- gets(z);
- printf("Pierwszy napis: %s\n", x);
- printf("Drugi napis: %s\n", z);
- if (strlen(x) > strlen(z)) {
- printf("Dłuższy jest napis: %s\n", x);
- } else {
- printf("Dłuższy jest napis: %s\n", z);
- } */
- //zad4
- int a;
- int b;
- int c;
- int csq;
- int tmp;
- int p;
- printf("Podaj a: \n");
- scanf("%d\n", &a);
- printf("Podaj b: \n");
- scanf("%d\n", &b);
- printf("Podaj c: \n");
- scanf("%d\n", &c);
- tmp = (a * a + b * b);
- csq = c * c;
- printf("A = %d\nB = %d\nC = %d\n", a, b, c);
- if (tmp == csq) {
- printf("Podane boki mogą być bokami trójkąta prostokątnego\n");
- p = a * b / 2;
- printf("Jego pole jest równe: %d", p);
- } else {
- printf("Podane boki nie spełniają wymagań");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement