All pastes #949621 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-19 22:23 UTC
rendered paste body
#include<stdio.h>
#include<stdlib.h>

int countArray(double *t); //, double low, double up);

main () {
	double temp[31];
	double *t;
	float day;
	int i;
	int year;
	int month;
	double count;
                     
	
	printf("dwse etos: ");
    scanf("%d", &year);
                     
	if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
	{
		printf("To etos %d einai disekto.\n", year);
		
		printf("dwse ton mina mou thelw na tsekarw tis thermokrasies.\n");
		scanf("%d", &month);
		
		if((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12)){
			
			int *t = (int *) malloc(31*sizeof(int));
			
			for(i=0; i<31; i++){
				printf("dwse ti mesi timi gia tin kathe mera \n");	
				scanf("%f", &day);
				temp[i] = day;
				
			}
			
			printf("i mesi thermokrasia gia kathe mera einai %lg", temp);
			count = countArray(*t);
			printf("to plithos twn imerwn pou i mesi thermokrasia einai metaksi 10 kai 20 einai: %d\n" , count);
			
		}	
		else if((month == 4)|| (month == 6) || (month == 9) || (month == 11)){
			
			int *t = (int *) malloc(30*sizeof(int));
			
			for(i=0; i<30; i++){
				printf("dwse ti mesi timi gia tin kathe mera \n");	
				scanf("%f", &day);
				temp[i] = day;
			}			
		}
		
		else
		{
			int *t = (int *) malloc(29*sizeof(int));
			
			for(i=0; i<29; i++){
				printf("dwse ti mesi timi gia tin kathe mera \n");	
				scanf("%f", &day);
				temp[i] = day;
			}
		
		}
	}
    else
	{	
                printf("To etos %d den einai disekto.\n", year);
	}


int countArray(double *t) //, double low, double up)
{
	double count;
	int i;
	double low;
	double up;
	
	low = 10;
	up = 20;
	count = 0;
	i = 0;
	
	for(i=0; i<31; i++){
		if(i>low || i<up)
			count++;
	}
	
	
	return(count);
	
}