Untitled
unknown
plain_text
2 years ago
843 B
10
Indexable
#include <stdio.h>
int main()
{
int n,t,rem,count=0,sum=0,rox,cal=0;
scanf("%d",&t);
scanf("%d",&n);
int k=n;
while (k)
{
k=k/10;
count++;
}
if (count==t)
{
///calculating the sum of the digits
int a=n;
while (a)
{
rem=a%10;
sum=sum+rem;
a/=10;
}
printf("Sum of digits: %d ",sum);
///calculating the mean of the digits
printf("Mean: %d ",(sum/count));
///calculating the even numbers.
while (n)
{
rox=n%2;
if (rox==0)
{
cal++;
}
n/=10;
}
printf("Number of even Digits: %d",cal);
}
return 0;
}
Editor is loading...