This commit is contained in:
2024-06-17 03:24:07 +03:00
parent 04d946e28c
commit 7522af1dc2
10 changed files with 105 additions and 5 deletions

22
DeitelC/Chapter4/1to20.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
int main(void){
int counter = 1;
while(counter<= 20) {
if(counter%5==0) {
printf("%d\t",counter);
counter++;
} else {
counter++;
}
}
printf("\n");
for(int x = 1; x<=20 ;++x) {
if (x%5==0) {
printf("%d\t", x);
} else {
}
}
return 0;
}

View File

@ -0,0 +1,15 @@
#include <stdio.h>
int CelciusConvert(int c) {
int f;
f = ((c*9)/5)+32;
return f;
}
int main(void) {
int c;
int f;
printf("%s\n", "Enter Celcius degree!");
scanf("%d", &c);
printf("%d %s %d",c, " Celcius equals to Fahrenheit: ", CelciusConvert(c));
}

Binary file not shown.

9
DeitelC/Chapter4/check.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
int main() {
int i = 5, j = 7, k = 4, m = -2;
//printf("%d", i >= 5 && j > 4);
/*printf("%d", !m && k > m);
printf("%d", !k || m); */
printf("%d", !2);
}

17
DeitelC/Chapter4/test1.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
int main()
{
int x, i, j;
// prompt user for input
printf("%s", "Enter an integer in the range 1-20:");
scanf("%d", &x); // read values for x
for (i = 1; i <= x; i++) { // count from 1 to x
for (j = 1; j <= x; j++) { // count from 1 to x
if (j==i)
printf("%c",'@'); // output @
else
printf(" ");
} // end inner for
printf("\n");
} // end outer for
} // end of main