Pagini recente » Cod sursa (job #76577) | Cod sursa (job #2477523) | Cod sursa (job #924194) | Cod sursa (job #645307)
Cod sursa(job #645307)
/*
* File: main.c
* Author: mihai
*
* Created on December 9, 2011, 12:16 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
*
*/
int main(int argc, char** argv) {
freopen ("submultimi.in", "r", stdin);
freopen ("submultimi.out", "w", stdout);
int n;
scanf ("%d", &n);
int i;
for (i = 1; i < 1 << n; i++)
{
int temp = i;
int element = 1;
while (temp){
if (temp & 1 == 1)
{
printf ("%d ", element);
}
temp = temp >> 1;
element++;
}
printf("\n");
}
return 0;
}