commit 1e29454ea9288e454932063acd9fca40375fee33
parent d31ad32aaf724d967e8e1b4a29c9942b96b5dda7
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Sun, 14 Sep 2025 20:11:20 +0530
Add files via upload
Diffstat:
8 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/tution-c/P10.c b/tution-c/P10.c
@@ -0,0 +1,23 @@
+/* WAP to find and display the difference
+between compound Interest and Simple Interest.
+Take principle amount as input.
+Hint : si = (p * r * t) / 100
+ a = p * ((1 + (r / 100)) ^ t)
+ ci = a - p
+*/
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double p, r, t, si, a, ci, dif;
+ printf("Enter the principle amount, rate of interest, time in year : ");
+ scanf("%lf %lf %lf", &p, &r, &t);
+ si = (p * r * t) / 100;
+ a = p * pow((1 + (r / 100)), t);
+ ci = a - p;
+ dif = ci - si;
+ printf("\nSimple Interest : %lf"
+ "\nCompound Interest : %lf"
+ "\nInterest Difference : %lf", si, ci, dif);
+ return 0;
+}
diff --git a/tution-c/P11.c b/tution-c/P11.c
@@ -0,0 +1,18 @@
+/* The time period of a simple pendulam is
+given by the formula :
+ t = 2 * pi * square_root(l / g)
+WAP to calculate T take length(L) and gravity
+as input
+*/
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double l, g, t;
+ printf("Enter the Length and Gravity measures : ");
+ scanf("%lf %lf", &l, &g);
+ t = 2 * M_PI * sqrt(l / g);
+ // using M_PI variable for PI value from math.h header file
+ printf("\nTime Period : %lf", t);
+ return 0;
+}
diff --git a/tution-c/P12.c b/tution-c/P12.c
@@ -0,0 +1,14 @@
+/* WAP to swap two integer variable without
+using third variable */
+// using Approch Mode : simple, slow, time consuming
+
+#include<stdio.h>
+int main() {
+ int a = 4, b = 6;
+ printf("Before Swap : A = %d, B = %d", a, b);
+ a = a + b;
+ b = a - b;
+ a = a - b;
+ printf("\nAfter Swap : A = %d, B = %d", a, b);
+ return 0;
+}
diff --git a/tution-c/P13.c b/tution-c/P13.c
@@ -0,0 +1,15 @@
+/* WAP to swap two integer variable without
+using third variable */
+// using Approch Mode : complex, fast, less time consumimg
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ int a = 4, b = 6;
+ printf("Before Swap : A = %d, B = %d", a, b);
+ a = a ^ b;
+ b = a ^ b;
+ a = a ^ b;
+ printf("\nAfter Swap : A = %d, B = %d", a, b);
+ return 0;
+}
diff --git a/tution-c/P14.c b/tution-c/P14.c
@@ -0,0 +1,17 @@
+/* WAP to accept the diagonal of
+square. Find and display the area and
+perimeter of the square. */
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double d, side, area, per;
+ printf("Enter the diagonal : ");
+ scanf("%lf", &d);
+ side = d / sqrt (2);
+ area = side * side;
+ per = 4 * side;
+ printf("\nArea of the Square : %lf"
+ "\nPerimeter of the Square : %lf", area, per);
+ return 0;
+}
diff --git a/tution-c/P15.c b/tution-c/P15.c
@@ -0,0 +1,17 @@
+/*WAP to accept number of days and
+display it after converting into
+number of years, months and days */
+
+#include<stdio.h>
+int main() {
+ int day, month, year, temp;
+ printf("Enter the number of days : ");
+ scanf("%d", &day);
+ temp = day;
+ year = day / 365;
+ day = day % 365;
+ month = day / 30;
+ day = day % 30;
+ printf("\n%d Days = %d Years %d Months %d Days", temp, year, month, day);
+ return 0;
+}
diff --git a/tution-c/P16.c b/tution-c/P16.c
@@ -0,0 +1,13 @@
+/* WAP to calculate and display radius of a
+circle by taking the area as input */
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double area, r;
+ printf("Enter the area of a circle : ");
+ scanf("%lf", &area);
+ r = sqrt((7 * area) / 22);
+ printf("\nRadius : %lf", r);
+ return 0;
+}
diff --git a/tution-c/P9.c b/tution-c/P9.c
@@ -0,0 +1,23 @@
+/* WAP to calculate gross and net salary
+by accepting basic salary as input.
+IMP : DA = 30% of Basic Pay
+ HRA = 20% of Basic Pay
+ PF = 12.5% of Basic Pay
+ Gross Salary = Basic Pay + DA + HRA
+ Net Salary = Gross Salary - PF
+*/
+
+#include<stdio.h>
+int main() {
+ double bs, da, hra, pf, gs, ns;
+ printf("Enter the Basic Salary : ");
+ scanf("%lf", &bs);
+ da = bs * 0.3;
+ hra = bs * 0.2;
+ pf = bs * 0.125;
+ gs = bs + da + hra;
+ ns = gs - pf;
+ printf("\nGross Salary : %lf"
+ "\nNet Salary : %lf", gs, ns);
+ return 0;
+}