Answer to Question #4726 in C++ for angel
write a c++ program for generate odd number
1
2011-10-18T11:26:34-0400
#include "stdafx.h"
#include "conio.h"
#include <iostream>
#include <cstdlib>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int number;
cout<<"Enter how many number generate? : ";
cin>>number;
int count=0;
for(;;){
& int random_integer = rand()%500;
& if(random_integer%2==1){
& count+=1;
cout <<count <<" odd number is "<< random_integer << endl;
& }
& if(count==number){
& break;
& }
&
}
& & getch();
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment