[ create a new paste ] login | about

Link: http://codepad.org/1EHR7tWc    [ raw code | fork ]

C, pasted on Nov 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

int main ( void)
{
	int x, n=0 ;

	printf ( "x=" ) ;
	scanf ( "%d", &x ) ;
	if ( x<=1 ){
		printf ( "不正な入力値です\n" ) ;
		return 1 ;
	}

	while(x>2){
		x = x/2+x%2 ;
		n++;
	}

	printf ( "2^%d(%d)\n", n, 1<<n ) ;
	return 0 ;
}


Create a new paste based on this one


Comments: