print first nodd numbers in descending order
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
How many namespaces are there in c++?
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
How to declare an array of pointers to integer?
What is the difference between containment and delegation?
What is #include math h in c++?
Explain how overloading takes place in c++?
What is the return value of the insertion operator?
Define precondition and post-condition to a member function?
What are formatting flags in ios class?
What is using namespace std in cpp?
What are the main differences between C and C++?