Showing posts with label Sum of digits. Show all posts
Showing posts with label Sum of digits. Show all posts

Tuesday, 22 September 2020

C program to find the sum of digits of any 5 digit number

September 22, 2020 Posted by Knowledge Bite , No comments
#include<stdio.h> #include<conio.h> void main() { clrscr(); //to add the digits of any five digits number int p,q,r,s,t,u,v,w,x,y; printf("enter any number of five digit\n for which you want to add its digits\n"); scanf("%d",&p); q=p%10; r=p/10; s=r%10; t=r/10; u=t%10; v=t/10; w=v%10; x=v/10; y=q+s+u+w+x; printf("%d",y); getch(); } ...