From 13831f3c0bb520962a4f87f29e999d100e1f7dd3 Mon Sep 17 00:00:00 2001 From: Keerthana Pravallika Samudrala <66155737+KeerthanaPravallika@users.noreply.github.com> Date: Tue, 25 May 2021 11:57:28 +0530 Subject: [PATCH] Armstrong Numbers in given interval --- Armstrong Numbers in given interval | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Armstrong Numbers in given interval diff --git a/Armstrong Numbers in given interval b/Armstrong Numbers in given interval new file mode 100644 index 0000000..4bfad42 --- /dev/null +++ b/Armstrong Numbers in given interval @@ -0,0 +1,27 @@ +#include + +int main() +{ + int start,end,i,tmp,d,sumOfCubes=0,num; + printf("Enter the interval : "); + scanf("%d ",&start); + scanf("%d",&end); + for(num = start;num<=end;num++) + { + sumOfCubes=0; + tmp = num; + while(tmp!=0) + { + d = tmp%10; + sumOfCubes = sumOfCubes + (d*d*d); + tmp = tmp/10; + } + if(num == sumOfCubes) + printf("%d is a Armstrong Number\n",num); + else + printf("%d is not a Armstrong Number\n",num); + + + } + return 0; +}