C
This commit is contained in:
parent
0ab1badbbf
commit
181560baae
@ -11,10 +11,14 @@ int main(void) {
|
|||||||
scanf("%d", &grade);
|
scanf("%d", &grade);
|
||||||
if(grade == 1) {
|
if(grade == 1) {
|
||||||
fail = fail + 1;
|
fail = fail + 1;
|
||||||
} else {
|
|
||||||
pass = pass + 1;
|
|
||||||
}
|
|
||||||
total = total + 1;
|
total = total + 1;
|
||||||
|
} else if(grade == 2) {
|
||||||
|
pass = pass + 1;
|
||||||
|
total = total + 1;
|
||||||
|
} else {
|
||||||
|
printf("%s\n","Invalid Number PLEASE ENTER A VALID NUMBER!(1 or 2)");
|
||||||
|
scanf("%d", &grade);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
puts((pass >= 8) ? "Bonus to Instructer!" : "");
|
puts((pass >= 8) ? "Bonus to Instructer!" : "");
|
||||||
}
|
}
|
26
DeitelC/TwoLargestNumber.c
Normal file
26
DeitelC/TwoLargestNumber.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(void) {
|
||||||
|
int number = 0;
|
||||||
|
int counter = 1;
|
||||||
|
int largest = 0;
|
||||||
|
int SecondLargest = 0;
|
||||||
|
|
||||||
|
while(counter <= 10) {
|
||||||
|
printf("%s\n","Enter 10 positive Integer");
|
||||||
|
scanf("%d", &number);
|
||||||
|
if(number >= largest) {
|
||||||
|
largest = number;
|
||||||
|
} else if (number > SecondLargest && number != SecondLargest){
|
||||||
|
SecondLargest = number;
|
||||||
|
} counter++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s %d\n", "Counter: ",counter);
|
||||||
|
printf("%s %d\n", "Largest: ",largest);
|
||||||
|
printf("%s %d\n", "SecondLargest: ",SecondLargest);
|
||||||
|
printf("%s %d\n", "Number: ",number);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
BIN
DeitelC/a.exe
BIN
DeitelC/a.exe
Binary file not shown.
15
DeitelC/test1.c
Normal file
15
DeitelC/test1.c
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
int outer_count = 1; // initialize count
|
||||||
|
while ( outer_count <= 10 ) { // loop 10 times
|
||||||
|
int inner_count = 1;
|
||||||
|
while (inner_count <= outer_count) {
|
||||||
|
printf("* ");
|
||||||
|
inner_count++;
|
||||||
|
} // end inner while
|
||||||
|
printf("\n");
|
||||||
|
outer_count++;
|
||||||
|
} // end outer while
|
||||||
|
} // end main
|
Loading…
x
Reference in New Issue
Block a user