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 are Structure passing and returning implemented by the compiler?

593


Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300

1783


What is a volatile variable in c++?

556


Does improper inheritance have a potential to wreck a project?

622


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

545






Why do we use using namespace std in c++?

595


Can we get the value of ios format flags?

655


How to declare a pointer to an array of integers?

640


How can a called function determine the number of arguments that have been passed to it?

654


Which software is best for c++ programming?

570


What is a unnitialised pointer?

525


Why use of template is better than a base class?

640


What is static class data?

569


Why are pointers not used in c++?

621


How many different levels of pointers are there?

652