forked from randerson112358/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathderivative.c
More file actions
34 lines (27 loc) · 702 Bytes
/
derivative.c
File metadata and controls
34 lines (27 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# include <stdio.h>
int main(void)
{
char variable[31];
int constant;
int power;
int i;
int d;
int multC = 1;
printf("Input Cx^n, C, LETTER, 2;\n");
printf("C: ");
scanf("%d", &constant);
printf("x: ");
scanf("%s", variable);
printf("n: ");
scanf("%d", &power); // if the power "n" = 0 then the derivative of C*x^0 = C * d/dx 1 = C*0 = 0
printf("What derivative?\n");
scanf("%d", &d);
for(i=0; i<d; i++)
{
multC*=(power - i);
}
printf("%d * %s^(%d)\n", multC*constant, variable, power - d);
//system("dir");
//system("echo Hello World");
system("pause");
}