Sunday, May 26, 2019

C programming : Program to find the sum of digits of three digit numbers.

/* 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
 

 

3 comments:

  1. Thanks For this Article.This is very helpful for me.Students who need more information about this topics, They can checkout Maxlearners for free.

    ReplyDelete
  2. I 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

    ReplyDelete
    Replies
    1. Y u r interested to buy this website as u have already ur website.

      Delete

Function

FUNCTION C enables programmer to break up a program into segments commonly known as functions, each of which can be written more or...