解答例 5-1

【問1】

#include <stdio.h>

int main( void )
{
	double a = 53.6, b = 84.7, c = 57.89;
	double kekka;

	kekka = ( a + b ) / ( c * b );

	printf( "小数形式 = %f\n", kekka );
	printf( "指数形式 = %e\n", kekka );

	return 0;
}

【問2】

#include <stdio.h>

int main( void )
{
	char str[] = "SKY";

	printf( "str[0] = %d %x %c\n", str[0], str[0], str[0] );
	printf( "str[1] = %d %x %c\n", str[1], str[1], str[1] );
	printf( "str[2] = %d %x %c\n", str[2], str[2], str[2] );
	printf( "str[3] = %d %x %c\n", str[3], str[3], str[3] );
	printf( "文字列 = %s\n", str );

	return 0;
}

戻る


banner初心者のためのポイント学習C言語」
Copyright(c) 2000-2004 TOMOJI All Rights Reserved