Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main (void)
  4. {
  5.     int quantidadeCasasDecimais;
  6.     double num;
  7.  
  8.     printf("Digite um número real: ");
  9.     scanf("%lf", &num);
  10.  
  11.     printf("Digite quantas casas decimais deseja: ");
  12.     scanf("%d", &quantidadeCasasDecimais);
  13.  
  14.     printf("Valor: %.*f\n", quantidadeCasasDecimais, num);
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement