4.
#include <stdio.h>
int main(void)
{
int s;
s=52;
printf("there are %d weeks in a year.\n",s);
return 0;
}
7.
#include <stdio.h>
int main ()
{
int words,lines;
words=3020;
lines=350;
printf("There were %d words and %d lines.\n",words,lines);
return 0;
}
1.
#include <stdio.h>
#define LEN 10
char a[LEN]="Viona";
char b[LEN]="Lovegood";
int main()
{
printf("%s %s\n",a,b);
printf("%s\n%s\n",a,b);
printf("%s %s\n",a,b);
return 0;
}
3.
#include <stdio.h>
int main()
{
int years,days;
years=20;
days=years*365;
printf("You have lived for %d days.\n",days);
return 0;
}
4.【自定义函数】
#include<stdio.h>
void jolly();
void deny();
int main()
{
jolly();
jolly();
jolly();
deny();
return 0;
}
void jolly()
{
printf("For he's a jolly good fellow!\n");
}
void deny()
{
printf("Which nobody can deny!\n");
}