Advertisement
LegoDrifter

Dali prvata cifra e ednakva so zbirot na drugite *my touch*

Jan 23rd, 2020
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3.   int z, n, sum,prvacifra,cifra;
  4.   scanf("%d",&z);
  5.   prvacifra = z / 1000;
  6.   n = z % 1000;
  7.   sum = 0;
  8.   while (n > 0) {
  9.   cifra = n % 10;
  10.   sum += cifra;
  11.   n /= 10;
  12.   }
  13.   if (sum == prvacifra) printf("DA");
  14.   else
  15.     printf("NE");
  16.  
  17.   return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement