C++/C++

Advertisement


Question
How do write a program that calculates and prints the product of odd integers


Answer
long loddnum =1;
 long imaxrange;
 unsigned long lproduct;
 cout<<"enter the range of maximum odd number";
 cin >> imaxrange;
 while(loddnum <= imaxrange)
 {
       long ltempoddnum = loddnum + 2;
       lproduct = ltempoddnum * loddnum;
       cout<<"the product of two numbers first number"<<loddnum<<"second number"<<ltempoddnum<<"equals"<<lproduct<<"\n";
       loddnum = ltempoddnum;
}

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


rakshitha

Expertise

Difficult questions related to C .

Experience

C ,vc ,opc ,windows CE, ActiveX

Education/Credentials
Masters in electrical engineering

©2016 About.com. All rights reserved.