/* Program to find the sum of the digits of a three digit numbers */
#include<stdio.h>
#include<conio.h>
void main( )
{
int n,a,b,c,sum=0;
printf("\n Enter the value of n ");
scanf("%d",&n);
a=n%10;
b=(n/10)%10;
c=(n/10)/10;
sum=a+b+c;
printf("\n Sum of the digits of three digit numbers is %d",sum);
getch();
}
Output
Enter the value of n
678
Sum of the digits of three digit numbers is 21
#include<stdio.h>
#include<conio.h>
void main( )
{
int n,a,b,c,sum=0;
printf("\n Enter the value of n ");
scanf("%d",&n);
a=n%10;
b=(n/10)%10;
c=(n/10)/10;
sum=a+b+c;
printf("\n Sum of the digits of three digit numbers is %d",sum);
getch();
}
Output
Enter the value of n
678
Sum of the digits of three digit numbers is 21
Thanks For this Article.This is very helpful for me.Students who need more information about this topics, They can checkout Maxlearners for free.
ReplyDeleteI am interested to buy your website if please contact for sell this is my website link here visit and click on contact or servers page you got my mobile number Features of Java
ReplyDeleteY u r interested to buy this website as u have already ur website.
Delete