#include stdio.hint main (void){int i1, i2;printf (Enter two numbers: );scanf (%i%i, i1, i2);
编程学习网为您整理以下代码实例,主要实现:除以两个给定的整数,显示结果为3位小数,希望可以帮到各位朋友。
#include <stdio.h>
int main (voID)
{
int i1, i2;
printf ("Enter two numbers: ");
scanf ("%i%i", &i1, &i2);
if (i2 == 0)
printf ("the second number cannot be zero.");
else
printf ("%i / %i = %.3f \n", i1, i2, (float) i1 / i2);
return 0;
}