Write a C++ Program to Generate Random Numbers between 0 and 100
Solution:
/* C++ Program to Generate Random Numbers between 0 and 100 */
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int i; //loop counter
int num; //store random number
cout<<"Generating Random Numbers Below ::
";
for(i=1;i<=10;i++)
{
num=rand()%100; //get random number
cout<<" "<<num<<" ";
}
cout<<"
";
return 0;
}
Output:
/* C++ Program to Generate Random Number between 0 and 100 */
Generating Random Numbers Below ::
41 67 34 0 69 24 78 58 62 64
Process returned 0
Is This Answer Correct ? | 0 Yes | 0 No |
What is data hiding c++?
Can user-defined object be declared as static data member of another class?
What are different types of typecasting supported by C++
What is ios class in c++?
What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?
What is the purpose of extern storage specifier?
What is stack unwinding?
what is a reference variable in C++?
What is the keyword auto for?
Const char *p , char const *p What is the difference between the above two?
What do you mean by late binding?
What are the classes in c++?