C
This commit is contained in:
parent
b9492bb8d7
commit
f5aa8d53b6
11
DeitelC/1to10Sum.c
Normal file
11
DeitelC/1to10Sum.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int x = 1;
|
||||
int sum = 0;
|
||||
while (x < 11) {
|
||||
sum += x;
|
||||
printf("%d\n", sum);
|
||||
x++;
|
||||
}
|
||||
}
|
15
DeitelC/3over10factoriel.c
Normal file
15
DeitelC/3over10factoriel.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int x;
|
||||
int i = 1;
|
||||
int total = 0;
|
||||
|
||||
while (i <= 10) {
|
||||
x = i * i * i;
|
||||
total += x;
|
||||
i++;
|
||||
}
|
||||
|
||||
printf("%d", total);
|
||||
}
|
26
DeitelC/SalesTax.c
Normal file
26
DeitelC/SalesTax.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
float monthTotal;
|
||||
float total;
|
||||
char month[20];
|
||||
|
||||
printf("%s\n", "Enter total amounth collected (-1 to stop!):");
|
||||
scanf("%f", &monthTotal);
|
||||
|
||||
while (monthTotal != -1) {
|
||||
total += monthTotal;
|
||||
printf("%s %.2f\n", "Current Total", total);
|
||||
printf("%s\n", "Enter total amounth collected (-1 to stop!):");
|
||||
scanf("%f", &monthTotal);
|
||||
}
|
||||
printf("%s\n", "Enter name of month:");
|
||||
scanf("%s", month);
|
||||
printf("The Month: %s\n",month);
|
||||
printf("%s %.2f\n", "Total Collections:", total);
|
||||
printf("%s %.2f\n", "Sales:", (total*91)/100);
|
||||
printf("%s %.2f\n", "County Sales Tax:", (total*5)/100);
|
||||
printf("%s %.2f\n", "State Sales Tax:", (total*4)/100);
|
||||
printf("%s %.2f\n", "Total Sales Tax Collected:", (total*9)/100);
|
||||
|
||||
}
|
22
DeitelC/XPowerY.c
Normal file
22
DeitelC/XPowerY.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int x;
|
||||
int y;
|
||||
|
||||
printf("%s\n","Please Enter a X value!");
|
||||
scanf("%d", &x);
|
||||
printf("%s\n", "Please Enter a Y value!");
|
||||
scanf("%d", &y);
|
||||
|
||||
int i = 1;
|
||||
int power = 1;
|
||||
|
||||
while (i <= y) {
|
||||
power *= x;
|
||||
i++;
|
||||
}
|
||||
|
||||
printf("%s %d", "Variable output:", power);
|
||||
|
||||
}
|
BIN
DeitelC/a.exe
BIN
DeitelC/a.exe
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user