format code and sign with gpg

This commit is contained in:
juan 2021-09-26 11:19:13 +08:00
parent 1461008519
commit 769d2273d1
No known key found for this signature in database
GPG key ID: 5C1E5093C74F1DC7
2 changed files with 33 additions and 33 deletions

View file

@ -1,16 +1,16 @@
#include <stdio.h> #include <stdio.h>
int main(void) int main(void) {
{ // initialization
//initialization
char sex; char sex;
int age; int age;
float height; float height;
//get input from stdin // get input from stdin
scanf("%c %i %f", &sex, &age, &height); scanf("%c %i %f", &sex, &age, &height);
//print answer to stdout // print answer to stdout
printf("The sex is %c, the age is %i, and the height is %f.", sex, age, height); printf("The sex is %c, the age is %i, and the height is %f.", sex, age,
height);
return 0; return 0;
} }

View file

@ -1,8 +1,7 @@
#include <stdio.h> #include <stdio.h>
int main(void) int main(void) {
{ // initialize variables
//initialize variables
char a; char a;
short b; short b;
int c; int c;
@ -11,15 +10,16 @@ int main(void)
float f; float f;
double g; double g;
//assign values from stdin // assign values from stdin
scanf ("%c %hd %i %ld %lld %f %lf", &a, &b, &c, &d, &e, &f, &g); scanf("%c %hd %i %ld %lld %f %lf", &a, &b, &c, &d, &e, &f, &g);
//print answers // print answers
printf("The 'char' variable is %c, it takes %ld byte.\n", a, sizeof(a)); printf("The 'char' variable is %c, it takes %ld byte.\n", a, sizeof(a));
printf("The 'short' variable is %hd, it takes %ld bytes.\n", b, sizeof(b)); printf("The 'short' variable is %hd, it takes %ld bytes.\n", b, sizeof(b));
printf("The 'int' variable is %i, it takes %ld bytes.\n", c, sizeof(c)); printf("The 'int' variable is %i, it takes %ld bytes.\n", c, sizeof(c));
printf("The 'long' variable is %ld, it takes %ld bytes.\n", d, sizeof(d)); printf("The 'long' variable is %ld, it takes %ld bytes.\n", d, sizeof(d));
printf("The 'long long' variable is %lld, it takes %ld bytes.\n", e, sizeof(e)); printf("The 'long long' variable is %lld, it takes %ld bytes.\n", e,
sizeof(e));
printf("The 'float' variable is %f, it takes %ld bytes.\n", f, sizeof(f)); printf("The 'float' variable is %f, it takes %ld bytes.\n", f, sizeof(f));
printf("The 'double' variable is %lf, it takes %ld bytes.\n", g, sizeof(g)); printf("The 'double' variable is %lf, it takes %ld bytes.\n", g, sizeof(g));