From e9df936201dee093302c5bc94cd508abdfecce54 Mon Sep 17 00:00:00 2001 From: Juman Kashyap <148629604+imkashyap888@users.noreply.github.com> Date: Sun, 22 Oct 2023 22:41:38 +0530 Subject: [PATCH 1/2] Update add_2_integers.c --- 00_operators/add_2_integers.c | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/00_operators/add_2_integers.c b/00_operators/add_2_integers.c index 28565f6..7904636 100644 --- a/00_operators/add_2_integers.c +++ b/00_operators/add_2_integers.c @@ -2,20 +2,22 @@ #include // start of the main function -int main(void) -{ - printf("Starting the program here: \n"); - - int integer1, integer2; // first and second number to be entered by the user - // int integer2; // second number to be entered by the user - - printf("Enter the first Integer:\n"); //prompt - scanf("%d", &integer1); // read the integer - - printf("Enter the second Integer:\n"); //prompt - scanf("%d", &integer2); // read the second integer - - int sum = integer1 + integer2; // assign the value of the total expression to sum - printf("Sum is %d\n", sum); - -}// end of the main function \ No newline at end of file +int main() { + int a, b, sum; + + // Get the first integer from the user + printf("Enter the first integer: "); + scanf("%d", &a); + + // Get the second integer from the user + printf("Enter the second integer: "); + scanf("%d", &b); + + // Add the two numbers + sum = a + b; + + // Display the result + printf("The sum of %d and %d is %d\n", a,b, sum); + + return 0; +}// end of the main function From ea0e2a149fcba42a74e1303f2fa93af68eca12e8 Mon Sep 17 00:00:00 2001 From: Juman Kashyap <148629604+imkashyap888@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:45:39 +0530 Subject: [PATCH 2/2] Update comma_operator.c --- 00_operators/comma_operator.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/00_operators/comma_operator.c b/00_operators/comma_operator.c index 1455237..70a53f2 100644 --- a/00_operators/comma_operator.c +++ b/00_operators/comma_operator.c @@ -2,9 +2,15 @@ #include /* function main starts program execution */ -int main(void) +int main() { - int a; - a = 89, 1336; - printf("%d\n", a); -} \ No newline at end of file + int a, b, c; + + a = (b = 5, c = 10); + + printf("a = %d\n", a); + printf("b = %d\n", b); + printf("c = %d\n", c); + + return 0; +}