commit 52a2ad3a1299264c3f67893ca9f0db394f340692
parent 162bd8e0fa03d406f5fa66391710d7e4a51e12d4
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Sun, 7 Sep 2025 19:35:58 +0530
Add files via upload
Diffstat:
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/tution-c/1.c b/tution-c/1.c
@@ -0,0 +1,28 @@
+// Write a program (WAP) to print the sum and product of digits of an integer.
+
+#include<stdio.h>
+
+int main() {
+ int inp, result_sum = 0, result_product = 1, temp;
+ printf("Please enter the number : ");
+ scanf("%d",&inp);
+ printf("\n");
+
+ if (inp < 0) {
+ printf("\nPlease enter a valid non negetive integer.");
+ return 1;
+ }
+
+ temp = inp;
+ while (temp != 0 ) {
+ result_sum = result_sum + (temp % 10);
+ result_product = result_product * (temp % 10);
+ temp = temp / 10;
+ }
+
+ printf("\nSum of the digits of the input number '%d' is : %d"
+ "\nProduct of the digits of the input number '%d' is : %d",
+ inp, result_sum, inp, result_product);
+ return 0;
+}
+
diff --git a/tution-c/1.exe b/tution-c/1.exe
Binary files differ.