Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int decimales;
- float numero;
- char cad[256];
- int main()
- {
- printf("Numero a leer: ");
- scanf("%f", &numero);
- printf("Cuantos decimales: ");
- scanf("%d", &decimales);
- sprintf(cad, "%%.%df\n", decimales);
- printf(cad, numero);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement