commit 2b04cc009dbc91b2ca8452b88c6edc27bf955d19
parent d388ef9c8289cd1b6d7a6f99c2eadcd972a2805f
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Tue, 7 Oct 2025 21:26:04 +0530
new 29
Diffstat:
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
@@ -59,6 +59,7 @@
"editor.inlineSuggest.enabled": false,
"files.associations": {
"math.h": "c",
- "stdio.h": "c"
+ "stdio.h": "c",
+ "ratio": "c"
}
}
\ No newline at end of file
diff --git a/letusc/luc029.c b/letusc/luc029.c
@@ -0,0 +1,29 @@
+/* Write a program to print out all Armstrong numbers between 100
+and 500. If sum of cubes of each digit of the number is equal to the
+number itself, then the number is called an Armstrong number. For
+example, 153 = (1 * 1 * 1) + (5 * 5 * 5) + (3 * 3 * 3) */
+/* Author - Amit Dutta, Date - 7th OCT, 2025 */
+/* Let Us C, Chap- 5, Page - 87, Qn No.: B(b) */
+
+#include <stdio.h>
+#include <math.h>
+int main()
+{
+ int num = 100, temp1, temp2, res;
+ printf("Armstrong numbers between 100 and 500 :");
+ while (num <= 500)
+ {
+ temp1 = num;
+ res = 0;
+ while (temp1 != 0)
+ {
+ temp2 = temp1 % 10;
+ res = res + pow(temp2, 3);
+ temp1 = temp1 / 10;
+ }
+ if (num == res)
+ printf(" %d", num);
+ num++;
+ }
+ return 0;
+}+
\ No newline at end of file