View Code of Problem 18

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
typedef struct{
	char name[20];
	int flag;
}Children;
int a[1000010];
int num[100000];
int max(int a,int b){
	return a>b?a:b;
}
int main(){
	int n;
	
	while(scanf("%d",&n)!=EOF){
		int sum=0,count=0;
		for(int i=1;i<=n;i++){
			sum+=count;
			if(i%2==0){
				count++;
			}
		}
		printf("%d\n",sum);
	}
} 




	

Double click to view unformatted code.


Back to problem 18