Question #28971

Program to generate odd No. 1 to 50 exp 17

Expert's answer

#include <iostream>

#include <ctime>

#include <cstdlib>

#include <math.h>

using namespace std;

int main()

{

int a =& rand() %50; //generate random variable

int c=a/2;

int& d=0;

d= fabs(c); & // absolute value c

int b=a-2*d; // if d=*.0 then b is even number, and then our number - 2*d =0

if(b=!0){ // if d!=*.0 then b is odd number, and then our number - 2*d !=0

cout << b<<a<< endl;}

return 0;

}

#include <ctime>

#include <cstdlib>

#include <math.h>

using namespace std;

int main()

{

int a =& rand() %50; //generate random variable

int c=a/2;

int& d=0;

d= fabs(c); & // absolute value c

int b=a-2*d; // if d=*.0 then b is even number, and then our number - 2*d =0

if(b=!0){ // if d!=*.0 then b is odd number, and then our number - 2*d !=0

cout << b<<a<< endl;}

return 0;

}

## Comments

## Leave a comment