Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <stdio.h>


//using namespace std;

 main()
{

  int k[400],xl,e[400];
 
  int i,j,l,n,p;
  int y;//,w,g;
 
   printf(" KAÇ SAYI");scanf("%d",&xl);
   for (i=0;i<xl;i++)   {
          printf(" SAYILAR VER.");scanf("%d",&n);
                e[i]=n;                         }

  for (i=0;i<100;i++) { k[i]=0;  }

    printf(" SONUCU VER.");scanf("%d",&l);
  
   if (xl>100) xl=100;

  i=0; j=0;y=0;

while (y!=l) {
   y=0;

   if (j>=xl) break;

  if (k[j]==0) {k[j]=1;j=0;}

  else {   k[j]=0;j++; }

  for (i=0;i<=xl;i++)  {  if(k[i]==1) y=y+e[i];  }
 
}
 

  p=0;
  for (i=0;i<xl;i++)
 {  if(k[i]==1) 
 { p=p+ e[i];
 printf("var        %d    \n",e[i]);
       }
  else printf("yok %d    \n",e[i]);
 }

 
  
  }
 
gcc version 4.6.3