commit 60147b5ebbd3bef98a5d0df7b3f333451ce0ed86
parent 0129f04c792f04985c5e87969b09a3d40b4eebe5
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Thu, 2 Oct 2025 21:12:57 +0530
LUC_O_NEW
Diffstat:
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/Letusc-exercises/lucproblem003.c b/Letusc-exercises/lucproblem003.c
@@ -0,0 +1,30 @@
+/* If a character is entered through the keyboard, Write a program
+to determine whether the character is a capital letter, a small case letter,
+a digit or a speacial symbol.
+The following table shows the range of ASCII values for various characters :
+ Characters ASCII Values
+ A - Z 65 - 90
+ a - z 97 - 122
+ 0 - 9 48 - 57
+ special symbols 0 - 47, 58 - 64, 91 - 96, 123 - 127
+*/
+/* Author - Amit Dutta, Date - 02th OCT, 2025 */
+/* Let Us C, Chap - 4, Page - 65, Problem 4.2 */
+
+#include <stdio.h>
+int main()
+{
+ char inp;
+ printf("Enter one character : ");
+ scanf(" %c", &inp);
+ if (inp >= 64 && inp <= 90)
+ printf("\nInput '%c' is a CAPITAL LETTER.", inp);
+ if (inp >= 97 && inp <= 122)
+ printf("\nInput '%c' is a SMALL CASE LETTER.", inp);
+ if (inp >= 48 && inp <= 57)
+ printf("\nInput '%c' is a DIGIT.", inp);
+ if (inp >= 0 && inp <= 47 || inp >= 58 && inp <= 64
+ || inp >= 91 && inp <= 96 || inp >= 123 && inp <= 127)
+ printf("\nInput '%c' is a SPECIAL SYMBOL.", inp);
+ return 0;
+}+
\ No newline at end of file
diff --git a/Letusc-exercises/lucproblem004.c b/Letusc-exercises/lucproblem004.c
@@ -0,0 +1,25 @@
+/* If the lengths of three sides of a triangle are entered through the
+keyboard, write a program to check whether the triangle is valid or not.
+The triangle is valid if the sum of two sides is greater that the largest
+of the three sides. */
+/* Author - Amit Dutta, Date - 02th OCT, 2025 */
+/* Let Us C, Chap - 4, Page - 66, Problem 4.3 */
+
+#include <stdio.h>
+int main()
+{
+ double side1, side2, side3;
+ printf("Enter the length of side1, side2 and side3 of the triangle : ");
+ scanf("%lf %lf %lf", &side1, &side2, &side3);
+ if (side1 <= 0 || side2 <= 0 || side3 <= 0)
+ {
+ printf("\nTriangle sides must be positive.\n");
+ return 1;
+ }
+ if ((side1 + side2 > side3) && (side1 + side3 > side2) && (side2 + side3 > side1))
+ // Triangle Inequality Theorem
+ printf("\nThis triangle is valid.");
+ else
+ printf("\nThis triangle is not valid.");
+ return 0;
+}+
\ No newline at end of file