print first nodd numbers in descending order

Answer Posted / vaishnavi

#include<iostream.h>
void main()
{
int i,n;
cout<<"Enter the number:"
cin>>n;
for(i=2*(n-1);i>=1;i=i-2)
{
cout<<i;
}
}

Is This Answer Correct ?    8 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you call C functions from C++ and vice versa?

634


What is runtime errors c++?

570


Write about the members that a derived class can add?

567


Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].

955


What is virtual function? Explain with an example

583






Array base access faster or pointer base access is faster?

1813


What is c++ hiding?

618


Explain virtual destructor?

673


Show the declaration for a static member variable.

524


How the keyword struct is different from the keyword class in c++?

582


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

628


What is using namespace std in c++?

603


Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?

2014


What does ios :: app do in c++?

551


What is a breakpoint?

559