commit e409af09bdfd8c6a5c49f4c42c3812907a20bcce
parent ef6d16aea069d33750ccf9fa7c5df6c5c6e56065
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Mon, 22 Sep 2025 18:10:21 +0530
Add files via upload
Diffstat:
4 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/tution-c/P017.c b/tution-c/P017.c
@@ -0,0 +1,16 @@
+/* Find maximum between three number. */
+
+#include <stdio.h>
+int main()
+{
+ int a, b, c, max;
+ printf("Enter the value for a, b, c : ");
+ scanf("%d %d %d", &a, &b, &c);
+ max = a;
+ if (max < b)
+ max = b;
+ if (max < c)
+ max = c;
+ printf("Maximum : %d", max);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tution-c/P018.c b/tution-c/P018.c
@@ -0,0 +1,26 @@
+/* WAP to input the cost price and selling price and
+calculate profit, profit percentage, loss percentage or
+display the manage nither profit nor loss. */
+
+#include <stdio.h>
+int main()
+{
+ double cost, sell, pro, prop, loss, lossp;
+ printf("Enter the cost and selling price : ");
+ scanf("%lf %lf", &cost, &sell);
+ if (sell > cost)
+ {
+ pro = sell - cost;
+ prop = (pro / cost) * 100;
+ printf("Profit : RS %g, Profit Percentage : %g", pro, prop);
+ }
+ else if (sell < cost)
+ {
+ loss = cost - sell;
+ lossp = (loss / cost) * 100;
+ printf("Loss : RS %g, Loss Percentage : %g", loss, lossp);
+ }
+ else
+ printf("Neither loss nor Profit.");
+ return 0;
+}+
\ No newline at end of file
diff --git a/tution-c/P019.c b/tution-c/P019.c
@@ -0,0 +1,26 @@
+/* WAP to input the distance covered and calculate
+the amount to be paid by the passanger.
+ Distance Rate
+ =<5KM RS 90
+ next 10KM RS 20/KM
+ next 10KM RS 10/KM
+ more than 25KM RS 9/KM
+*/
+
+#include <stdio.h>
+int main()
+{
+ double dis, amt;
+ printf("Enter the distance : ");
+ scanf("%lf", &dis);
+ if (dis <= 5.0)
+ amt = 90.0;
+ else if (dis > 5.0 && dis <= 15.0)
+ amt = 90.0 + (dis - 5.0) * 20;
+ else if (dis > 15.0 && dis <= 25.0)
+ amt = 90.0 + 200.0 + (dis - 15.0) * 10;
+ else if (dis > 25.0)
+ amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9;
+ printf("\nAmount to be paid : %g", amt);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tution-c/P020.c b/tution-c/P020.c
@@ -0,0 +1,27 @@
+/* WAP to calculate and display the maturity amount
+taking the sum and number of days as input.
+ No. of Days Rate of Interest
+ Upto 180 days 5.5 %
+ 181 to 364 days 7.5 %
+ exact 365 days 9.0 %
+ more than 365 days 8.5 %
+*/
+
+#include <stdio.h>
+int main()
+{
+ double nod, amt, s, i;
+ printf("Enter the amount and the time in days : ");
+ scanf("%lf %lf", &s, &nod);
+ if (nod <= 180)
+ i = (s * 5.5 * (nod / 365)) / 100;
+ else if (nod > 180.0 && nod <= 364.0)
+ i = (s * 7.5 * (nod / 365)) / 100;
+ else if (nod == 365.0)
+ i = (s * 9.0 * 1) / 100;
+ else if (nod > 365.0)
+ i = (s * 8.5 * (nod / 365)) / 100;
+ amt = s + i;
+ printf("Amount to be paid : %g", amt);
+ return 0;
+}+
\ No newline at end of file