Advertisement
youuw

zad5 C

Oct 24th, 2021
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char **argv) {
  4.  
  5.     int a, b; //deklaracja zmiennych
  6.     printf("podaj pierwsza liczbe\n"); //wyswietlenie komunikatu
  7.     scanf("%d", &a); //wprowadzenie zmiennych
  8.     printf("podaj druga liczbe\n");
  9.     scanf("%d", &b);
  10.  
  11.     printf("a/b ");
  12.     printf("%d", a/b); //wyswietlenie wyniku a/b
  13.     printf("\nb/a ");
  14.     printf("%d", b/a); //wyswietlenie wyniku b/a
  15.     //wyniki sa zawsze takie jakie sie spodziewalem - int nie potrafi przechowywac liczb zmiennoprzecinkowych, dlatego wyswietla niepoprawne wyniki dla wynikow "z reszta"
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement