Computer Science, asked by DessikaDuku, 1 year ago

Give me the c++ program code for sum of series,odd /even using loop. Plz............

Answers

Answered by yasas
1
i m writing the programming using c style 
#include<iostream.h>
#include<conio.h>
void main()
{
    int n,i,sum;
    clrscr();
   cout<<"enter the limit"<<endl;
   cin>>n;
   i=1;sum=0;
   while(i<=n)
   {
        cout<<i<<endl;
         sum=sum+i;
         i++;
   }
   cout<<"sum of <<i<<"numbers is = "<<sum;
   int temp=0;
   for(i=2;i<n;i++)
     {
        if(n%i==0)
         {
            cout<<i<<endl;
            temp=temp+i;
          }
      }
       cout<<"sum od even numbers is "<<temp;
    getch();
}

DessikaDuku: Thank u pa gonna do my practicals well ya?!!
yasas: ohh nyc do well
Similar questions