Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include<time.h>
  4.  
  5. int main(void) {
  6.  
  7.     int a;
  8.     time_t czas;
  9.  
  10.     scanf("%d", &a);
  11.     int sum = 0;
  12.     for (int i = 0; i < a; i++) {
  13.         int randomNumber = rand() % 1001;
  14.         printf("%d %10ld\n", i, rand() % 1001);
  15.         sum += randomNumber;
  16.     }
  17.  
  18.     printf("Suma liczb losowych: %d", sum);
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement