Home
Mega Menu
FYBCS
_C
_HTML & CSS
SYBCS
_DS
_SCILAB
TYBCS
_JAVA
_PHP
Download Apk
Home
c
C Program - Write a program to accept an integer and count the number of digits in the number and sum of digit
C Program - Write a program to accept an integer and count the number of digits in the number and sum of digit
prozone
June 07, 2018
Program
#include<stdio.h>
int main()
{
int a,j=0,p,sum=0;
printf("enter the no : ");
scanf("%d",&a);
while(a!=0)
{
p=a%10;
a=a/10;
j++;
sum=sum+p;
}
printf("digit= %d and sum= %d",j,sum);
}
Output:
enter the no : 4532
digit= 4 and sum= 14
Post a Comment
0 Comments
Popular Posts
C Program - Write a program to accept a matrix A of size mXn and store its transpose in matrix B. Display matrix B. Write separate functions
June 15, 2018
C Program - Write a program to accept n number and display the array in the reverse order. write separate function to accept and display
June 14, 2018
C Program - Accept temperatures in Fahrenheit (F) and print it in Celsius (C) and Kelvin(K)
May 31, 2018
Follow Us
Tags
Powered by Blogger
0 Comments