mirror of
https://github.com/nolongeractivemp3/shipthatcode-c.git
synced 2026-11-24 10:45:12 +01:00
2
This commit is contained in:
1 parent
1f079a8b9d
commit
904310819d
1 file changed
+6
-13
@@ -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;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user