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#

VulpesRank #55 · 29.2K reputationPosted Feb 24, 2014, 5:40 AM EST
Ehtesham MehmoodRank #719 · 3.3K reputationPosted Feb 24, 2014, 7:23 AM EST
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;
}
}
}
Vithal WadjeRank #19 · 47.2K reputationPosted Feb 24, 2014, 8:04 AM EST
Alaa Asi4 reputationPosted Feb 25, 2014, 5:37 AM EST
Thanks for the help guys next time ill try to do it myself
Ehtesham MehmoodRank #719 · 3.3K reputationPosted Feb 25, 2014, 6:15 AM EST