#include<stdio.h> int main(void) { printf("朱妍\n"); printf("朱\n"); printf("妍\n"); printf("朱妍\n"); return 0; }
#include<stdio.h> int main(void) { printf("朱妍\n"); printf("浙江樹人大學\n"); return 0; }
#include<stdio.h> int main(void) { int ageYear; int ageDays; int totalDays; ageYear=18; ageDays=365; totalDays=ageYear*ageDays; printf("totalDays=%d",totalDays); return 0; }
For he's a jolly good fellow! For he's a jolly good fellow! For he's a jolly good fellow! Which nobody can deny! 除了main()函數之外,該程序還要調用兩個自定義函數:一個名爲jolly(),用於打印前三條消息,調用一次打印一條;另外一個函數名爲deny(),打印最後一條消息。函數
#include<stdio.h> void jolly(); void deny(); int main(void) { 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"); }
Brazil,Russia,India,China India,China Brazil,Russia 除了main()之外,該程序還要調用兩個自定義函數:一個名爲br(),調用一次打印一次「Brazil,Russia」;另外一個名爲ic(),調用一次打印一次「India,China"。其餘內容在main()函數中完成。code
#include<stdio.h> void br(); void ic(); int main() { br(); printf(","); ic(); printf("\n"); ic(); printf(","); printf("\n"); br(); return 0; } void br() { printf("Brazil,Russia"); } void ic() { printf("Lndia,China"); }
#include<stdio.h> int main(void) { int toes=10; int dbtoes,pftoes; dbtoes=toes*2; pftoes=toes*toes; printf("%d\n",toes); printf("%d\n",dbtoes); return 0; }
Smile!Smile! Smile! 該程序要定義一個函數,該函數被調用一次打印一次「Smile!",根據程序的須要使用該函數。three
#include<stdio.h> void wx(); void hh(); int main(void) { wx(); wx(); wx(); hh(); wx(); wx(); hh(); wx(); hh(); return 0; } void wx() { printf("Smile!"); } void hh() { printf("\n"); }
void one_three(); void two(); int main(void) { printf("starting now\n"); one_three(); printf("done!\n"); return 0; } void one_three() { printf("one\n"); two(); printf("three\n"); } void two() { printf("two\n"); }