SHARE
TWEET

3.2 Основна задача

Mihajlo_K Mar 17th, 2019 (edited) 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Од стандарден влез се чита број N, a потоа се читаат N броеви.
  2. Да се испечати сумата,производот и разликата на сумата со просекот на тие N броеви на стандарден излез. */
  3.  
  4. #include <stdio.h>
  5. int main()
  6. {
  7.     int n, i, sum = 0, p = 1;
  8.     float prosek;
  9.     scanf("%d", &n);
  10.     int b[n];
  11.     for(i = 0; i < n; i++)
  12.     {
  13.         scanf("%d", &b[i]);
  14.         sum = sum + b[i];
  15.         p = p * b[i];
  16.     }
  17.     prosek = sum / (float)n;
  18.     printf("%d %d %.2f", sum, p, (sum - prosek));
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top