Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 1, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/beb0325540151af7cb2882be35f95db9 to your computer and use it in GitHub Desktop.
Save parzibyte/beb0325540151af7cb2882be35f95db9 to your computer and use it in GitHub Desktop.
/*
Utilizar scanf para leer una variable flotante en C
@author parzibyte.me
*/
#include <stdio.h>
int main(){
float numero; // Aquí alojaremos el valor leído
printf("Dime un número flotante:\n");
scanf("%f", &numero); // Atención al operador &
printf("El número que pusiste es: %0.2f", numero);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment