Compare commits
3 Commits
c71ffdd716
...
24d05e18d6
Author | SHA1 | Date | |
---|---|---|---|
24d05e18d6 | |||
00f742e3bc | |||
9b9861b7c4 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.out
|
Binary file not shown.
20
DeitelC/Chapter4/barChart.c
Normal file
20
DeitelC/Chapter4/barChart.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
puts("Enter 5 different integers between 1 - 30!");
|
||||
for(int i = 0; i < 5; i++) {
|
||||
printf("Enter %d. integer: ",(i+1));
|
||||
int j;
|
||||
if(!scanf("%d", &j)) {
|
||||
puts("Enter a valid integer!");
|
||||
} else if((j < 1 || j > 30)) {
|
||||
puts("Integer not between 1-30!");
|
||||
}
|
||||
|
||||
for(int t = 0; t < j; t++) {
|
||||
printf("%s","*");
|
||||
}
|
||||
puts("");
|
||||
|
||||
}
|
||||
}
|
7
DeitelC/Chapter4/calculateSales.c
Normal file
7
DeitelC/Chapter4/calculateSales.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main (void){
|
||||
int i, j;
|
||||
|
||||
|
||||
}
|
33
DeitelC/Chapter4/creditLimit.c
Normal file
33
DeitelC/Chapter4/creditLimit.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
int accNum;
|
||||
float limit, debt;
|
||||
puts("Enter 3 customer details!");
|
||||
for(int counter = 0; counter < 3; counter++){
|
||||
puts(" ");
|
||||
puts("Enter account number: ");
|
||||
int a = scanf("%d", &accNum);
|
||||
puts("Enter credit limit: ");
|
||||
int b = scanf("%f", &limit);
|
||||
puts("Enter current debt: ");
|
||||
int c = scanf("%f", &debt);
|
||||
|
||||
|
||||
|
||||
if (!a || !b || !c) {
|
||||
puts ("Enter valid data!");
|
||||
}
|
||||
|
||||
printf("Account number: %d, Account old credit limit: %.2f, Account current debt: %.2f.\n", accNum, limit, debt);
|
||||
|
||||
if(limit/2 < debt) {
|
||||
puts("WARNING! ACCOUNT DEBT MORE THAN NEW LIMIT!");
|
||||
printf("New credit limit: %.2f, Current debt: %.2f\n", (limit/2), debt);
|
||||
} else {
|
||||
printf("New credit limit: %.2f, Current debt: %.2f\n", (limit/2), debt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user