Advertisement
metalni

Strukturno Labs #4

Oct 30th, 2019 (edited)
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. /* Programa koja gi presmetuva sumite na parovite cifri od petcifren broj, vnesen od tastatura, i gi prikazuva na ekran, zaedno so tretata cifra, koja ostanuva sama*/
  2.  
  3. #include <stdio.h>
  4. int main() {
  5.     int broj, cif1, cif2, cif3, cif4, cif5, suma1, suma2;
  6.     scanf("%d", &broj);
  7.     cif1=broj/10000;
  8.     cif2=(broj/1000)%10;
  9.     cif3=(broj/100)%10;
  10.     cif4=(broj/10)%10;
  11.     cif5=broj%10;
  12.     suma1=cif1+cif5;
  13.     suma2=cif2+cif4;
  14.     printf("%d %d %d", suma1, suma2, cif3);
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement