print first nodd numbers in descending order

Answer Posted / rabid manatee

#include <iostream>
using namespace std;

int main(int argc, char *argv[]) {

int n = 4;

if (argc == 2) {
n = atoi(argv[1]);
}

for(int i=n; i >= 0; i--) {
cout << i*2 + 1 <<endl;
}

}

Is This Answer Correct ?    3 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the insertion operator and what does it do?

561


Can c++ do everything c can?

590


What is abstraction with real time example?

610


What is the difference between interpreters and compilers?

622


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

597






What's c++ used for?

587


What is an adjust field format flag?

641


What are the effects after calling the delete this operator ?

548


What sorting algorithm does c++ use?

594


Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300”,”BullCart : 10”) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side

3040


What are the advantages of using a pointer?

600


Which is better turbo c++ or dev c++?

557


How do you sort a sort function in c++ to sort in descending order?

549


What does n mean in c++?

621


What is buffering in c++?

578