-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.c
27 lines (22 loc) · 851 Bytes
/
input.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
int main() {
int age;
printf("Dame tu edad: ");
scanf("%d", &age); //scanf es inseguro, scanf_s es una mejora de microsoft
//por lo que gcc tine eproblemas para compilar, pero
//clang no. gcc produce mejor código.
printf("Tienes %d a%cos\n", age, 164); //c funciona en ASCII
char name[20];
fgets(name, 20, stdin); //scanf solamente escanea hasta el primer espacio
//en blanco, fgets captura también el último salto
//de linea
double dou1;
double dou2;
printf("Dame el primer número:\n");
scanf("%lf", &dou1);
printf("%f\n", dou1);
printf("Dame el segundo número:\n");
scanf("%lf", &dou2);
printf("%f\n", dou2);
return 0;
}