Advertisement
evgenko

rgr

Dec 14th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <tgmath.h>
  3. #define N 14
  4.  
  5. int main() {
  6.     int days[N];
  7.     int count_of_bad_days=0;
  8.     int sum = 0;
  9.     int count_of_good_days=0;
  10.     for (int i=0;i<N;i++){
  11.         printf("Etner the temp for day %d: ",i+1);
  12.         scanf("%d",&days[i]);
  13.         if (days[i]<0)
  14.             count_of_bad_days++;
  15.         else {
  16.             sum += days[i];
  17.             count_of_good_days++;
  18.         }
  19.     }
  20.     printf("Count of good days: %d",count_of_good_days);
  21.     printf("\nMiddle temp: %f\n", (float) sum/count_of_good_days);
  22.     printf("Enter the temp: ");
  23.     int temp;
  24.     scanf("%d",&temp);
  25.     for (int i=0;i<N;i++){
  26.         if (temp<days[i]){
  27.             printf("Number of day: %d\n",i+1);
  28.         }
  29.     }
  30.     for (int i=0;i<N;i++){
  31.         for (int j=i;j<N;j++){
  32.             if (days[i]>days[j]){
  33.                 int c = days[i];
  34.                 days[i] = days[j];
  35.                 days[j] = c;
  36.             }
  37.         }
  38.     }
  39.  
  40.    for (int i=0;i<N;i++){
  41.        printf("%d ",days[i]);
  42.    }
  43.  
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement