Sum of first any " n " even numbers
Sum of first any " N " even numbers
where N=0,1,2,3,4,...........
========================================================================
#include<iostream>
using namespace std;
main()
{
int sum=0,n,nums,m;
cout<<"Enter total Numbers to add\n";
cin>>n;
m=(n*2)-2;
for(int i=0;i<=m;i++)
{
if(i%2==0)
{
sum=sum+i;
}
}
cout<<"Sum of two numbers\n";
cout<<sum;
}
========================================================================
Code By: Kabeer Hussain & Usman Ibrahim
0 comments:
Post a Comment