2019年6月25日 星期二

C語言(online c) 寫簡單的 程式 ( 輸入一個數值判斷數值為偶數或奇數 )

C語言(online c) 寫簡單的 程式 ( 輸入一個數值判斷數值為偶數或奇數 )

#include<stdio.h>
#include<math.h>
int main()
{
    int x, f, a, b;
    printf("請輸入一數字( 1~200):\n");
    scanf("%d", &x);
    printf("你輸入的 N=%d\n", x);
    printf("\n1. 此數字是:");

    if (x % 2 == 0)
        printf("偶數");
    else
        printf("奇數");
 
    return 0;     
}     


沒有留言:

張貼留言

Python Modbus 控制 ADAM-6050 18-ch Isolated Digital I/O Module

Python Modbus 控制  ADAM-6050 18-ch Isolated Digital I/O Module import tkinter as tk from tkinter import messagebox from pymodbus.client impor...