This commit is contained in:
deck committed 2026-10-03 22:36:38 +02:00
1 parent 1f079a8b9d
commit 904310819d
1 file changed
+6 -13
+6 -13
View File
@@ -1,18 +1,11 @@
#include <stdio.h> #include <stdio.h>
#include <string.h>
int main(void) { int main(void) {
/* Already done for you: read one line of text into name and drop the double test = 0.0;
Enter key from its end. The Strings lesson explains how this works. */ double test2 = 0.0;
char name[256] = ""; scanf("%lf\n%lf", &test, &test2);
if (fgets(name, sizeof name, stdin) == NULL) { double sum = test+test2;
name[0] = '\0'; int intsum = (int)sum;
} printf("%f\n%d", sum,intsum);
name[strcspn(name, "\r\n")] = '\0';
/* TODO: print the two lines described in the exercise.
Use a %s placeholder for name; do not type any name yourself. */
printf("Hello, %s!\nWelcome to C.", name);
return 0; return 0;
} }