Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,sum=0,i,sum1=0;
  5. while(1)
  6. {
  7. scanf("%d",&n);
  8. if(n%2==0 && n!=0)
  9. {
  10. for(i=1; i<=5; i++)
  11. {
  12. sum=sum+n;
  13. n+=2;
  14. }
  15. printf("%d\n",sum);
  16. }
  17. else if(n%2!=0)
  18. {
  19. for(i=1,n++; i<=5; i++)
  20. {
  21. sum1=sum1+n;
  22. n+=2;
  23. }
  24. printf("%d\n",sum1);
  25. }
  26. else if(n==0)
  27. break;
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement