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

How to declare a function pointer?

0 Answers  


What are the different types of variables in C++?

1 Answers  


how to connect with oracle 9i with server in socket program in c/c++

0 Answers   3i Infotech,


Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .

0 Answers  


What is the difference between an array and a list?

0 Answers  


What happens when you make call 'delete this;'?

0 Answers  


Is c++ double?

0 Answers  


When we use Abstract Class and when we use Interface?where we will implement in real time?

0 Answers  


Which operator cannot be overloaded c++?

0 Answers  


What are the different types of polymorphism?

3 Answers  


Write about the use of the virtual destructor?

0 Answers  


Refer to a name of class or function that is defined within a namespace?

0 Answers  


Categories