Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <tgmath.h>
- #define N 14
- int main() {
- int days[N];
- int count_of_bad_days=0;
- int sum = 0;
- int count_of_good_days=0;
- for (int i=0;i<N;i++){
- printf("Etner the temp for day %d: ",i+1);
- scanf("%d",&days[i]);
- if (days[i]<0)
- count_of_bad_days++;
- else {
- sum += days[i];
- count_of_good_days++;
- }
- }
- printf("Count of good days: %d",count_of_good_days);
- printf("\nMiddle temp: %f\n", (float) sum/count_of_good_days);
- printf("Enter the temp: ");
- int temp;
- scanf("%d",&temp);
- for (int i=0;i<N;i++){
- if (temp<days[i]){
- printf("Number of day: %d\n",i+1);
- }
- }
- for (int i=0;i<N;i++){
- for (int j=i;j<N;j++){
- if (days[i]>days[j]){
- int c = days[i];
- days[i] = days[j];
- days[j] = c;
- }
- }
- }
- for (int i=0;i<N;i++){
- printf("%d ",days[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement