//pgm to find the sum and average of odd and even numbers between 1 and 10
#include<iostream.h>
#include<conio.h>
void main()
{
int i,sumo,sume,averageo,averagee;
clrscr();
sumo=sume=0;
for(i=1;i<=10;i++)
{
if(i%2==0)
{
sume=sume+i;
}
else
{
sumo=sumo+i;
}
}
averagee=sume/5;
averageo=sumo/5;
cout<<"sume="<<sume<<endl<<"sumo="<<sumo<<endl;
cout<<"averagee="<<averagee<<endl<<"averageo="<<averageo;
getch();
}
Please Click on ADS!!
Please Click on the above ads given by GOOGLE , so that I can maintain my blog!!
Tuesday, August 31, 2010
Find the sum and average of odd and even numbers between 1 and 10
Posted by
Mukesh
at
8/31/2010 08:32:00 PM
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment