pages

Friday, 9 April 2021

c-program | program to calculate the sum of the digits of three digits numbers in c-programming.

 program to calculate the sum of three digits of a number in c-programming?

In this program, we will learn how to calculate the sum of the digits of three digits by entering the values of n by the user.


#include<stdio.h>
#include<conio.h>
 main()
{
   int n,s;
   printf("enter the three digit number");
   scanf("%d",&n);
   s=n%10+n/10%10+n/100;
   printf("sum of %d is",s);
   getch();
}


output:- enter the three digits number =483
                   sum of the digits =15


For more c-programming :-

1.






No comments:

Post a Comment