Minggu, Juni 22, 2014

Define float Variable As Input On C Programming Language

Example of define one float variable as input on C programming language:

main()
{
  float num;
  printf("input a number! ");
  scanf("%f", &num);
  printf("float value is inputted: %f", num);
  getch();
}

Example of define two float variables as input on C programming language:

main()
{
  float num1, num2;
  printf("input num1! ");
  scanf("%f", &num1);
  printf("input num2! ");
  scanf("%f", &num2);
  printf("float1 variable value is input: %f", num1);
  printf("\nfloat1 variable value is input: %f", num2);
  getch();
}


0 komentar: