This commit is contained in:
kaltinsoy committed 2024-03-26 11:15:25 +03:00
1 parent 4ecfebcd1b
commit 04d946e28c
38 files changed
+91

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+30
View File
@@ -0,0 +1,30 @@
#include <stdio.h>
double powerFun(double base, int exponent) {
double result = 1.0;
for (int i = 0; i < exponent; i++) {
result *= base;
}
return result;
}
int main(void) {
int userData;
printf("Please Enter x (in E^x): ");
scanf("%d", &userData);
double constant = 2.0; // Initialize constant as a double
double counter = 1.0; // Initialize counter to 1.0
double data = 1.0; // Initialize data to 1.0
for (int i = 1; i <= userData; i++) {
data *= constant; // Update data by multiplying with constant
double term = powerFun(userData, i) / data; // Calculate the term for the current iteration
counter += term; // Add the term to the counter
printf("counter: %f\n", counter);
}
printf("e^%d = %f\n", userData, counter);
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+17
View File
@@ -0,0 +1,17 @@
#include <stdio.h>
int main(void) {
float constant = 2;
float counter = 2;
float data = 1;
float check = 1;
while(constant <= 40) {;
data = constant * data;
check = 1/data;
counter = check + counter;
printf("%s %f\n","counter :", counter);
constant++;
}
return 0;
}
+30
View File
@@ -0,0 +1,30 @@
#include <stdio.h>
int powerFun(int userData, int i) {
float result = 1.0;
while (i > 0) {
result *= userData;
i--;
}
return result;
}
int main(void) {
double constant = 2;
double counter = 2;
double data = 1;
float check = 1;
int userData;
int i = 1;
printf("%s\n","Please Enter x (in E^x): ");
scanf("%d", &userData);
while(i <= userData) {
data = constant * data;
check = powerFun(userData, i)/data;
counter = check + counter;
printf("%s %f\n","counter :", counter);
printf("%s %d\n","PowerFun:", powerFun(userData, i));
i++;
constant++;
}
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
#include <stdio.h>
#include <math.h>
int main(void) {
int sum = 0;
int count = 1;
for(;count<=99;count+=2) {
sum += count;
}
printf("%d\n", sum);
printf("%.2f\n", pow(2.5,3));
return 0;
}