Example of the simplest program in using float variable on C programming language is program of divison of two numbers, because division result usually is not integer, example as follows:
main()
{
float num1,num2;
printf("input first number! ");
scanf("%g", &num1);
printf("input second number! ");
scanf("%g", &num2);
printf("%g : %g = %g", num1, num2, num1/num2);
getch();
}
main()
{
float num1,num2;
printf("input first number! ");
scanf("%g", &num1);
printf("input second number! ");
scanf("%g", &num2);
printf("%g : %g = %g", num1, num2, num1/num2);
getch();
}
0 komentar:
Posting Komentar