#include <stdio.h> int main( void ) { int kekka[51]; int a, b, i; int amari; printf( "整数値を2つ入力してください " ); scanf( "%d%d", &a, &b ); if( b == 0 ){ printf( "処理終了\n" ); return 0; } printf( "%d / %d = ", a, b ); kekka[0] = a/b; for ( i = 1; i < 51;i++ ) { amari = a%b; if ( amari == 0 ) break; a = amari * 10; kekka[i] = a/b; } printf( "%d.", kekka[0] ); for ( a = 1; a < i; a++ ) { printf( "%d", kekka[a] ); } printf( "\n" ); return 0; }
▼戻る▼
「初心者のためのポイント学習C言語」 Copyright(c) 2000-2004 TOMOJI All Rights Reserved