bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit 00edaf1e81f06ecb349a4032f381d438edc5b572
parent 1fc255fb8736e5a69e24a0039e7eec8569617b3b
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Sun,  7 Sep 2025 19:46:20 +0530

Add files via upload
Diffstat:
Atution-c/1234.c | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/tution-c/1234.c b/tution-c/1234.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; +} +
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror