Write a C++ Program to Generate Random Numbers between 0 and 100
Answer Posted / hr
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 |
Post New Answer View All Answers
What is std :: endl?
What is the cout in c++?
What is the difference between while and do while loop? Explain with examples.
What is fflush c++?
What type of question are asked in GE code writing test based on c++ data structures and pointers?
Is c++ a good beginners programming language?
Which is best ide for c++?
What is searching?
What is data abstraction? How is it different from data encapsulation?
Can you explicitly call a destructor on a local variable?
What is exception handling? Does c++ support exception handling?
What is size_type?
Can constructor be static in c++?
Which operator cannot overload?
What is the need of a destructor?