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 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; +}