mirror of
https://github.com/nolongeractivemp3/shipthatcode-c.git
synced 2026-11-24 10:45:12 +01:00
lessson 5
This commit is contained in:
1 parent
cb7facc880
commit
93bcca369a
1 file changed
+6
-9
@@ -1,16 +1,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int nums[5];
|
char buf[100] = "";
|
||||||
for (int i = 0; i < 5; i++) scanf("%d", &nums[i]);
|
fgets(buf, sizeof buf, stdin);
|
||||||
|
|
||||||
int best = nums[0];
|
for (int i=0; !(buf[i] == '\0'); i++) {
|
||||||
for (int i = 0; i<5; i++) {
|
if (buf[i] == '\n') {buf[i] = '\0';}
|
||||||
if (nums[i] > best) {
|
|
||||||
best= nums[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
printf("%d\n", (int)strlen(buf));
|
||||||
printf("%d\n", best);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user