Answer to Question #4726 in C++ for angel

Question #4726
write a c++ program for generate odd number
1
Expert's answer
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS