2 power 4 = 16 and the sum of the digits is 1 + 6 = 7
2 power 15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26
What is the sum of the digits of the number 2 power 1000
2 power 15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26
What is the sum of the digits of the number 2 power 1000
2 comments:
#include"stdio.h"
#include"math.h"
int main()
{
long double a,b,val,sum;
int count;
a=2.0; b=1000.0;
sum=0;count=0;
val = pow(a,b);
printf("%Lf",val);
while(val>1.0)
{
sum+=(int)fmod(val,10);
val = val/10;
count++;
}
printf("\n\n\n%Lf\n\n%d",sum,count);
}
Watz this dude...am i supposed to solve the question thru c program..??
Post a Comment