View Code of Problem 80

#include <stdio.h>
2.int a[100000];
3.int main()
4.{
5.	int n,i,j,count,flag;
6.	while(scanf("%d",&n),n!=0)
7.	{
8.		count=n;
9.		flag=0;
10.		for(i=1;i<=n;i++)
11.			a[i]=1;
12.		while(count>1)
13.		{
14.			for(j=1;j<=n;j++)
15.			{
16.				if(a[j])
17.				{
18.					flag++;
19.					if(flag%3==0)
20.					{
21.						a[j]=0;
22.						count--;
23.					}
24.				}
25.			}
26.		}
27.		for(i=1;i<=n;i++)
28.			if(a[i])
29.			{
30.				printf("%d\n",i);
31.				//break;
32.			}
33.	}
34.	return 0;
35.}

/*
Main.c:2:1: error: invalid suffix "int" on floating constant
 2.int a[100000];
 ^
Main.c:2:1: error: expected identifier or '(' before numeric constant
Main.c:3:1: error: invalid suffix "int" on floating constant
 3.int main()
 ^
Main.c:3:1: error: expected identifier or '(' before numeric constant
*/

Double click to view unformatted code.


Back to problem 80