print first nodd numbers in descending order

Answers were Sorted based on User's Feedback



print first nodd numbers in descending order..

Answer / nagarajan n.

int n;
cout<<"enter a num:";
cin>>n;
for(int i=n;i>=1;i--)
{
if((i%2)!=0)
{
cout<<i<<"/t";
}
}

Is This Answer Correct ?    50 Yes 26 No

print first nodd numbers in descending order..

Answer / 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

print first nodd numbers in descending order..

Answer / dudelzy

#include <iostream>

using namespace std;

int main()
{
int num, x;
cout << "No. of odd numbers u want to find ";
cin >> num;
cout << "" << endl;
for(x = num; x <= num; x--){
if(x % 2 == 1){
cout << x << endl;
}
}
return 0;
}

Is This Answer Correct ?    0 Yes 4 No

print first nodd numbers in descending order..

Answer / prk

void main()
{
int i,n,k;
cout<<"Enter the number:";
cin>>n;
k=n%2;
if(k==0)
n=n-1;

for(i=n;i<=n;i=1-2)
cout<<1;
}

Is This Answer Correct ?    9 Yes 15 No

print first nodd numbers in descending order..

Answer / clearner

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

Is This Answer Correct ?    5 Yes 12 No

print first nodd numbers in descending order..

Answer / radhakrishnan

main()
{
int i,n,k;
cout>>"Enter the number:";
cin<<n;
k=n%2;
if(k==0)
n=n-1;

for(i=n;i<=n;i=1-2)
cout>>1;
}

Is This Answer Correct ?    3 Yes 11 No

print first nodd numbers in descending order..

Answer / 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

More C++ General Interview Questions

Which should be more useful: the protected and public virtuals?

0 Answers  


how to explain our contribution in the project?

0 Answers   Wipro, Yahoo,


What is meaning of in c++?

0 Answers  


In how many ways we can initialize an int variable in C++?

1 Answers  


What is a dll entry point?

0 Answers  






how to swap two strings without using any third variable ?

11 Answers  


How to declare a pointer to an array of integers?

0 Answers  


Name some pure object oriented languages?

1 Answers  


What is the meaning of c++?

0 Answers  


Does c++ support exception handling?

0 Answers  


What is the difference between reference and pointer?

0 Answers  


What are the uses of c++ in the real world?

0 Answers  


Categories