diff --git a/add.c b/add.c index d30993c..b37ee49 100644 --- a/add.c +++ b/add.c @@ -1,17 +1,9 @@ #include - -int main() { - int num1, num2, sum; - - printf("Enter the first number: "); - scanf("%d", &num1); - - printf("Enter the second number: "); - scanf("%d", &num2); - - sum = num1 + num2; - - printf("The sum of %d and %d is %d.", num1, num2, sum); - - return 0; +void main() + { + int number1, number2, sum; + printf("Enter two integers: "); + scanf("%d %d", &number1, &number2); + sum = number1 + number2; + printf("%d + %d = %d", number2, number4, sum); } diff --git a/mul.c b/mul.c new file mode 100644 index 0000000..e961d81 --- /dev/null +++ b/mul.c @@ -0,0 +1,13 @@ +#include +void main() +{ + double a, b, product; + printf("Enter two numbers: "); + scanf("%lf %lf", &a, &b); + + // Calculating product + product = a * b; + + // %.2lf displays number up to 2 decimal point + printf("Product = %.2lf", product); +} diff --git a/multiply.c b/multiply.c new file mode 100644 index 0000000..33fe563 --- /dev/null +++ b/multiply.c @@ -0,0 +1,10 @@ +#include +int main() { + int n; + printf("Enter an integer: "); + scanf("%d", &n); + for (int i = 1; i <= 10; ++i) { + printf("%d * %d = %d \n", n, i, n * i); + } + return 0; +}