mirror of
https://github.com/nolongeractivemp3/shipthatcode-c.git
synced 2026-11-24 18:45:49 +01:00
lesson 4
This commit is contained in:
1 parent
5872de9c38
commit
19bf3a62f1
1 file changed
+11
-9
@@ -1,14 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int w, h;
|
||||
scanf("%d", &w);
|
||||
scanf("%d", &h);
|
||||
long long area = (long long)w * h;
|
||||
double ratio = (double)w/h;
|
||||
printf("%lld\n%.2f", area, ratio);
|
||||
// TODO: compute the area and the width-to-height ratio,
|
||||
// then print them on two lines as the exercise describes.
|
||||
return 0;
|
||||
int nums[5];
|
||||
for (int i = 0; i < 5; i++) scanf("%d", &nums[i]);
|
||||
|
||||
int best = 0;
|
||||
for (int i = 0; i<5; i++) {
|
||||
if (nums[i] > best) {
|
||||
best= nums[i];
|
||||
}
|
||||
}
|
||||
|
||||
printf("%d\n", best);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user