bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit 96dda067dc2d397bcc30aa8c0fddba9963ba3598
parent a9c53a0067912b3a3b490e21cc78d65a6efb3c0a
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Tue, 21 Oct 2025 18:51:16 +0530

new _luc

Diffstat:
Aletusc/luc037.c | 30++++++++++++++++++++++++++++++
Aletusc/luc038.c | 27+++++++++++++++++++++++++++
Aletusc/luc039.c | 20++++++++++++++++++++
Aletusc/luc039.exe | 0
4 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/letusc/luc037.c b/letusc/luc037.c @@ -0,0 +1,29 @@ +/* The natural logarithm can be approximated by the following series. + (x-1)/x + 1/2 ((x-1)/x)^2 + 1/2 ((x-1)/x)^3 + 1/2 ((x-1)/x)^4 + ... +If x is input through the keyboard, write a program to calculate the +sum of the first seven terms of this series. */ +/* Author - Amit Dutta, Date - 21th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(d) */ + +#include <stdio.h> +#include <math.h> + +double series(double x) // made this fn only for fun, making a fn was not necessary +{ + double result = (x - 1) / x; + int i; + for (i = 2; i <= 7; i++) + { + result += 0.5 * pow(((x - 1) / x), i); + } + return result; +} + +int main() +{ + double x; + printf("Enter the value for x : "); + scanf("%lf", &x); + printf("\nResult : %g", series(x)); + return 0; +}+ \ No newline at end of file diff --git a/letusc/luc038.c b/letusc/luc038.c @@ -0,0 +1,26 @@ +/* Write a program to generate all Pythagorean Triplets with slide +length less than or equal to 30. */ +/* Author - Amit Dutta, Date - 21th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(e) */ + +#include <stdio.h> +#include <math.h> + +int main() +{ + int a, b, c; + printf("Pythagorean Triplets with slide length less than or equal to 30 : \n"); + for (a = 1; a <= 30; a++) + { + for (b = a; b <= 30; b++) + { + int c_square = a * a + b * b; + for (c = b + 1; c <= 30; c++) + { + if (c * c == c_square) + printf("(%d, %d, %d)\n", a, b, c); + } + } + } + return 0; +}+ \ No newline at end of file diff --git a/letusc/luc039.c b/letusc/luc039.c @@ -0,0 +1,19 @@ +/* Population of a town today is 100000. The population has increased +steadily at the rate of 10% per year for last 10 years. Write a +program to determine the population at the end of each year in the +last decade. */ +/* Author - Amit Dutta, Date - 21th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(f) */ + +#include <stdio.h> +int main() +{ + int i, population = 100000; + printf("Present year : %d\n", population); + for (i = 1; i <= 10; i++) + { + population /= 1.10; + printf("%d year ago : %d\n", i, population); + } + return 0; +}+ \ No newline at end of file diff --git a/letusc/luc039.exe b/letusc/luc039.exe Binary files differ.
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror