write a program that receives a number the program has to print the sum of all even numbers from 1 to the the received number (x) (including it )
please write it without the complicated things in school we just started learning about for loop a week ago and all the other things i know are the basics of C#
Ehtesham MehmoodPosted Feb 25, 2014, 11:15 AM
Alaa AsiPosted Feb 25, 2014, 10:37 AM
Thanks for the help guys next time ill try to do it myself
Vithal WadjePosted Feb 24, 2014, 1:04 PM
Ehtesham MehmoodPosted Feb 24, 2014, 12:23 PM
Any how take idea from this.
main()
{
int result=0;
int num=0; // in this variable you have to take input from the user.
for(int i=1;i<=num;i++)
{
if(i%2==0)
{
result=result+i;
}
}
}
VulpesPosted Feb 24, 2014, 10:40 AM