add 2nd assignment
This commit is contained in:
parent
26653397dd
commit
461b156b05
18
pset2/2-num.c
Normal file
18
pset2/2-num.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
// initialize variables
|
||||
int a, b;
|
||||
scanf("%d %d", &a, &b);
|
||||
|
||||
// print answer (I don't want to assign vars lol)
|
||||
if (a == b) {
|
||||
printf("The two numbers are equal.");
|
||||
} else if (a > b) {
|
||||
printf("The larger number is %i, the smaller number is %i.", a, b);
|
||||
} else {
|
||||
printf("The larger number is %i, the smaller number is %i.", b, a);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
27
pset2/3-year.c
Normal file
27
pset2/3-year.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
// initialize values
|
||||
int year;
|
||||
scanf("%i", &year);
|
||||
|
||||
// calculate values
|
||||
if (year % 4 == 0) {
|
||||
if (year % 100 == 0) {
|
||||
if (year % 400 == 0) {
|
||||
printf("Yes");
|
||||
return 0;
|
||||
} else {
|
||||
printf("No");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
printf("Yes");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
printf("No");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue