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
Explain linked list using c++ with an example?
What parameter does the constructor to an ofstream object take?
Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?
Are there interfaces in c++?
Write syntax to define friend functions in C++.
How much do c++ programmers make?
What is the equivalent of Pascal's Real a) unsigned int b) float c) char
What is the two main roles of operating system?
When should I use unitbuf flag?
What is the difference between strcpy() and strncpy()?
Which is the best c++ compiler?
What is a far pointer? where we use it?
Write a program to concatenate two strings.
What does new return if there is insufficient memory to make your new object?
What is the use of volatile variable?