#include <iostream>
using namespace std;
int main()
{
int end_num,sum=0;
cout << "Enter integer for which u want to get Product: ";
cin >> end_num;
for (int i=1;i<=end_num;i++)
{
if(i%2==1)
{
sum=sum+i;
}
}
cout << "The Sum of Odd Numbers Between 1 and " << end_num << " is = " << sum <<endl;
return 0;
}
No comments:
Post a Comment