Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ rand

#include<iostream>
#include<stdlib.h>
#include <time.h>

using namespace std;

int main(){
srand((unsigned)time(NULL));
srand((unsigned)rand());
int n,sum=0;
cin >> n;
int f[n];
for(int i=0; i<n; i++){
f[i]= rand()%30;
if (f[i]%2==0)
sum+=f[i];
}
cout << sum;
}
Source by www.cyberforum.ru #
 
PREVIOUS NEXT
Tagged: #rand
ADD COMMENT
Topic
Name
7+3 =