summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cst120/week_1/homework_1.c8
-rw-r--r--cst120/week_3/homework_3.c14
-rw-r--r--cst120/week_4/quiz_4_program_part.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/cst120/week_1/homework_1.c b/cst120/week_1/homework_1.c
index a29cfa6..bb9a6c4 100644
--- a/cst120/week_1/homework_1.c
+++ b/cst120/week_1/homework_1.c
@@ -41,12 +41,12 @@ int main(void) {
product = user_number_one * user_number_two;
/* Print the sum of the two user numbers */
- printf("The sum of the two numbers is %lld\n",
+ printf("The sum of the two numbers is %ld\n",
user_number_one + user_number_two);
/* Print the product of the two user numbers */
- printf("The product of the two numbers is %lld\n", product);
+ printf("The product of the two numbers is %ld\n", product);
/* Print the digit count of the product */
- printf("The product of the two numbers has %lld digits\n",
+ printf("The product of the two numbers has %ld digits\n",
count_digits(product));
return 0;
@@ -60,7 +60,7 @@ int64_t get_positive_user_input(void) {
for (;;) {
/* Get and store the user's input */
printf("Enter a positive number: ");
- scanf("%llu", &user_input);
+ scanf("%lu", &user_input);
/* If the user's number is positive, return the number; otherwise, ask the
* user for another number. */
diff --git a/cst120/week_3/homework_3.c b/cst120/week_3/homework_3.c
index ce4f0e3..a22a8ed 100644
--- a/cst120/week_3/homework_3.c
+++ b/cst120/week_3/homework_3.c
@@ -61,7 +61,7 @@ int main(void) {
int safe_input(int64_t *number) {
/* Prompt and accept input from user */
printf("Enter a number: ");
- scanf("%llu", number);
+ scanf("%lu", number);
/* Make sure that the user's number is within the valid range */
if (*number < -1000000 || *number > 1000000) {
@@ -159,11 +159,11 @@ static void clear_screen_ansi(void) {
#ifdef _WIN32
#pragma warning(disable : 4013)
/* clrscr(); */
-#pragma warning(default : 4013)
+/* #pragma warning(default : 4013) */
#else
-#pragma warning(disable : 4129)
- printf("\e[1;1H\e[2J");
-#pragma warning(default : 4129)
+ /* #pragma warning(disable : 4129) */
+ printf("\033[1;1H\033[2J");
+/* #pragma warning(default : 4129) */
#endif
}
@@ -190,7 +190,7 @@ void operations_table(int is_multiplication) {
printf("\n ");
for (i = 1; i <= SIZE; ++i) {
- printf("%3llu", i);
+ printf("%3lu", i);
}
/* The complete-dash row */
@@ -208,7 +208,7 @@ void operations_table(int is_multiplication) {
/* Multiply and print the final value */
for (j = 1; j <= SIZE; ++j) {
- printf("%3llu", is_multiplication ? i * j : i + j);
+ printf("%3lu", is_multiplication ? i * j : i + j);
}
printf("\n");
diff --git a/cst120/week_4/quiz_4_program_part.c b/cst120/week_4/quiz_4_program_part.c
index 8c4fbf6..a76454d 100644
--- a/cst120/week_4/quiz_4_program_part.c
+++ b/cst120/week_4/quiz_4_program_part.c
@@ -99,4 +99,4 @@ char caesar_cipher_encrypt(const char *message, const int *key) {
return (char)toupper(
(char)((*message + *key - CAESAR_CIPHER_MESSAGE_SAFETY_BOUND) % 26 +
CAESAR_CIPHER_MESSAGE_SAFETY_BOUND));
-} \ No newline at end of file
+}