1. Write a complete program that outputs two random numbers on two different lines. Ensure that the program gives a different result on every run.
note: please use c++
Code
#include<stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;
//main driver code of the program
int main(){
//seed the ranodm number geneartor on every run
srand(time(NULL));
//print the random numbers using rand() method
cout<<rand()<<"\n"<<rand()<<"\n";
}
Screenshot
Output
Get Answers For Free
Most questions answered within 1 hours.