Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sum_alg(int x) {
- int sum=0, y;
- while (x>0){
- y = x % 10;
- x/=10;
- sum+=y;
- }
- return sum;
- }
- int main() {
- int A=0, B=1, C, N, SUM=0;
- scanf ("%d", &N) ;
- while(N) {
- C=A+B;
- B=A;
- A=C;
- if (C%2==0){
- N--;
- SUM+=C;
- }
- printf("%d ",C);
- }
- printf("\n%d %d", SUM, sum_alg(SUM));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement