How can I print the fifth part of a real number?

2

How could I print the fifth (index 4 from the dot) part of a real number without using libraries or a "complex" code for opening chapters.

  • Make a program that reads a real number, and print the fifth part of that number.
asked by anonymous 13.10.2017 / 14:00

1 answer

1
#include <stdio.h>
#include <stdlib.h>

int main (void) {
   double entrada, quintaParte;
   printf ("Digite um numero: \n");

   scanf ("%lf", &entrada);

   quintaParte = entrada * 1/5;
   printf ("A quinta parte de %lf eh: \n %lf\n",  entrada, quintaParte);

   return 0;
}

    
13.10.2017 / 14:20