Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
95
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 a,i,count=0,sum=0;
  5.  
  6. while(1)
  7. {
  8. scanf("%d",&a);
  9.  
  10. if(a==0)
  11. {break;}
  12.  
  13. else
  14. {
  15. if(a%2==0){
  16. for(i=a;count<=5;i+=2)
  17. {
  18. sum = sum+i;
  19. count++;
  20. }
  21. printf("%d\n",sum);
  22. }
  23.  
  24. else{
  25. for(i=(a+1);count<=5;i+=2)
  26. {
  27. sum = sum+i;
  28. count++;
  29. }
  30. printf("%d\n",sum);
  31. }
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement