SHARE
TWEET

Untitled

a guest Feb 19th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top