C Program to find the sum of the cube of the digits of a
C three digit number
write(*,*)'Enter a three digit number:'
read(*,*)n
m=n
r=mod(n,10)
n=n/10
i=mod(n,10)
n=n/10
write(*,*)'The digits of the number',m,'is',n,',',i,',',r
k=n**3+i**3+r**3
write(*,*)'The sum of the cube of these digits is',k
end
C three digit number
write(*,*)'Enter a three digit number:'
read(*,*)n
m=n
r=mod(n,10)
n=n/10
i=mod(n,10)
n=n/10
write(*,*)'The digits of the number',m,'is',n,',',i,',',r
k=n**3+i**3+r**3
write(*,*)'The sum of the cube of these digits is',k
end
Comments
Post a Comment