Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6. random();
  7. int min = 1;
  8. int max = 10;
  9.  
  10. int numA;
  11. int numB;
  12.  
  13. numA = (rand() % (max - min) + 1) + min;
  14. printf("Случайное число = %d \n", numA);
  15.  
  16.  
  17. numB = (rand() % (max - min) + 1) + min;
  18. printf("Случайное число = %d \n", numB);
  19.  
  20. int sum = numA + numA;
  21.  
  22. while ((numA - numB) > 1) {
  23. numA = numB;
  24.  
  25. numB = (rand() % (max - min) + 1) + min;
  26. printf("Случайное число = %d \n", numB);
  27. }
  28.  
  29. printf("Сумма = %d", sum);
  30.  
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement