diff --git a/DeitelC/BonusInstructor.c b/DeitelC/BonusInstructor.c new file mode 100644 index 0000000..41fe9f3 --- /dev/null +++ b/DeitelC/BonusInstructor.c @@ -0,0 +1,20 @@ +#include + +int main(void) { + int total = 0; + int grade = 0; + int pass = 0; + int fail = 0; + + while(total < 10) { + printf("%s","Enter grade (grades must be 1 or 2 !) "); + scanf("%d", &grade); + if(grade == 1) { + fail = fail + 1; + } else { + pass = pass + 1; + } + total = total + 1; + } + puts((pass >= 8) ? "Bonus to Instructer!" : ""); +} \ No newline at end of file diff --git a/DeitelC/ClassAvarage.c b/DeitelC/ClassAvarage.c new file mode 100644 index 0000000..ea83c32 --- /dev/null +++ b/DeitelC/ClassAvarage.c @@ -0,0 +1,31 @@ +#include + +int main(void) { + int total = 0; + int counter = 0; + + printf("%s","Enter grades!, -1 to End: "); + int grade = 0; + scanf("%d", &grade); + while(grade != -1) { + total = total + grade; + counter = counter + 1; + + printf("%s", "Enter grades!, -1 to End: "); + scanf("%d", &grade); + } + + if (counter != 0) { + + double avarage = (double) total / counter; + + printf("Class average is %.2f\n", avarage); + printf("%d ", total); + printf("%d ", counter); + printf("%.0f", avarage); + + + } else { + puts("Enter a valid number!"); + } +} \ No newline at end of file diff --git a/DeitelC/ConditionalExpression.c b/DeitelC/ConditionalExpression.c new file mode 100644 index 0000000..126481f --- /dev/null +++ b/DeitelC/ConditionalExpression.c @@ -0,0 +1,15 @@ +#include + +int main() { + int grade; + printf("%s\n", "Enter your grade!"); + scanf("%d", &grade); + if (grade >= 60) { + printf("%s\n", "You passed!"); + + } else { + printf("%s\n", "You failed!"); + printf("%d\n", grade); + } + printf((grade <= 60) ? "Fail" : "Passed"); +} \ No newline at end of file diff --git a/DeitelC/PseudocodeBonusInstructor.md b/DeitelC/PseudocodeBonusInstructor.md new file mode 100644 index 0000000..8b98600 --- /dev/null +++ b/DeitelC/PseudocodeBonusInstructor.md @@ -0,0 +1,5 @@ +1- 10 results must entered! +2- Each number 1 or 2 if number none of this than program only checks number = 1 if is not than program thinks +it's 2 +3- Two counters are used one to count the number of students who passed and failed. +4- After the results, if 8 students passed the exam and, if so, print "Bonus to Instructer!" \ No newline at end of file diff --git a/DeitelC/a.exe b/DeitelC/a.exe new file mode 100644 index 0000000..8b7a33f Binary files /dev/null and b/DeitelC/a.exe differ