int main() //int : 宣告其回傳值為整數 main : 函數(本程式的主要函數)
{
printf("Hello, World! \n"); //printf:輸出到螢幕,列印出Hello world! \n : 換行字元
return 0; //將整數0回傳給呼叫main的函數
}
int main() //int : 宣告其回傳值為整數 main : 函數(本程式的主要函數)
{
printf("Hello, World! \n"); //printf:輸出到螢幕,列印出Hello world! \n : 換行字元
return 0; //將整數0回傳給呼叫main的函數
}
int main()
{
int first, second, add, subtract, multiply;
float divide;
printf("Enter two integers\n");
scanf("%d%d", &first, &second);
add = first + second;
subtract = first - second;
multiply = first * second;
divide = first / (float)second; //typecasting
printf("Sum = %d\n",add);
printf("Difference = %d\n",subtract);
printf("Multiplication = %d\n",multiply);
printf("Division = %.2f\n",divide);
return 0;
}
#include <stdio.h>
int main()
{
int n;
printf("Enter an integer\n");
scanf("%d", &n);
if (n%2 == 0)
printf("Even\n");
else printf("Odd\n");
return 0;
}