Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Write a C++ Program to Generate Random Numbers between 0 and 100



Write a C++ Program to Generate Random Numbers between 0 and 100..

Answer / 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

More C++ General Interview Questions

What is data hiding c++?

0 Answers  


Can user-defined object be declared as static data member of another class?

0 Answers  


What are different types of typecasting supported by C++

1 Answers   CA,


What is ios class in c++?

0 Answers  


What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?

0 Answers  






What is the purpose of extern storage specifier?

0 Answers  


What is stack unwinding?

0 Answers  


what is a reference variable in C++?

0 Answers  


What is the keyword auto for?

0 Answers  


Const char *p , char const *p What is the difference between the above two?

0 Answers   TCS,


What do you mean by late binding?

0 Answers  


What are the classes in c++?

0 Answers  


Categories