#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
標頭檔
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
程式主體
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
印出 Hello World
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
printf
函數
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
字串
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
程式結束
#include<stdio.h>
int main()
{
printf("%s", "Hello World\n");
return 0;
}
印出 Hello World
#include<stdio.h>
int main()
{
int number;
printf("Please input an integer:\n");
scanf("%d", &number);
printf("The integer you inputed is:\n");
printf("%d\n", number);
return 0;
}
宣告變數
#include<stdio.h>
int main()
{
int number;
printf("Please input an integer:\n");
scanf("%d", &number);
printf("The integer you inputed is:\n");
printf("%d\n", number);
return 0;
}
scanf 函數
讀取輸入至變數
#include<stdio.h>
int main()
{
int number;
printf("Please input an integer:\n");
scanf("%d", &number);
printf("The integer you inputed is:\n");
printf("%d\n", number);
return 0;
}
印出變數內容
#include<stdio.h>
int main()
{
int number;
printf("Please input an integer:\n");
scanf("%d", &number);
printf("The integer you inputed is:\n");
printf("%d\n", number);
return 0;
}