Friday 4 July 2014

Sum of odd and even numbers up to 100


//Sum of odd and even numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int sumeven=0,sumodd=0,i;
clrscr();
for(i=0;i<=100;++i)
{
if(i%2==0)
sumeven=sumeven+i;
else
sumodd=sumodd+i;
}
cout<<"SUM OF EVEN NUMBERS="<<sumeven;
cout<<"\nSUM OF ODD NUMBERS="<<sumodd;
getch();

}

1 comment:

  1. factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    factorial-of-hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.

    ReplyDelete