Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.     int liczba1, liczba2;
  7.     float srednia, iloraz;
  8.    
  9.     printf("Podaj pierwsza liczbe: \n");
  10.     scanf("%d", &liczba1);
  11.     printf("Podaj druga liczbe: \n");
  12.     scanf("%d", &liczba2);
  13.    
  14.     printf("Suma wynosi: %d \n", liczba1 + liczba2);
  15.    
  16.     srednia = (float) (liczba1 + liczba2) / 2;
  17.     printf("Srednia arytmetyczna wynosi: %.3f \n", srednia);
  18.    
  19.     if(liczba2 == 0 ){
  20.         printf("Nie mozna dzielic przez zero \n");
  21.         return 0;
  22.     }
  23.    
  24.     iloraz = (float) liczba1 / liczba2;
  25.     printf("Iloraz wynosi: %.3f \n", iloraz );
  26.    
  27.    
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement