2014年12月27日 星期六

java程式設計題目---數字處理【雙生質數(使用method)】

Twin primes(雙生質數) are a pair of prime numbers that differ by 2. For example, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 are twin primes. Write a program to find all twin primes less than 1,000. Display the output as follows:
(3,5)
(5,7)
...

java程式設計題目---公式計算【梅森質數(使用method)】

A prime number is called a Mersenne prime(梅森質數) if it can be written in the form 2^p-1 for some positive integer p.
Write a program that finds all Mersenne prime with p<=31 and displays the output as follows:
p     2^p-1
2         3
3         7
5         31
...

2014年12月26日 星期五

java程式設計題目---數字處理【迴文質數判斷(使用method)】

A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Display 10 numbers line, separated by exactly one space, as follows:
2 3 5 7 11 101 131 151 181 191
313 353 373 383 727 757  787 797 919 929

java程式設計題目---數字處理【迴文判斷(使用method)】

Write the methods with the following headers:
public static int reverse(int number)
public static Boolean isPalindrome(int number)
Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.

java程式設計題目---數字處理【數值反轉(使用method)】

Write a method with the following header to display an interger in reverse order:
public static int reverse(int number)
For example, reverse(3456) displays 6543. Write a test program that promotes the user to enter an integer and displays its reversal.

java程式設計題目---字母處理【輸出字母、換行(使用method)】

Write a method that prints characters using the following header:
public static void printChars(char ch1, char ch2, int numberPerLine)
This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program the prints ten characters per line from 1 to Z. Character are separated by exactly one space.

java程式設計題目---圖形繪製【使用2的n次方印三角形(使用method)】

Write a method to display a pattern as follows:
1
1  2
1  2  4
1  2  4  8
      ...
1  2  4  8   ....
The method header is
public static void displayPattern(int n)

java程式設計題目---數字處理【由大到小排序(使用method)】

Write a method with the following header to display three numbers in decreasing order:
public static void displaySortedNumbers(double num1, double num2, double num 3)
Write a test program that prompts the user to enter three numbers and invokes the method to display them in decreasing order.

java程式設計題目---公式計算【判斷一年有幾天(使用method)】

Write a method that returns the number of days in a year using the following header:
public static int numberOfDaysInAYear(int year)
Write a test program that displays the number of days in year from 2000 to 2020.

java程式設計題目---數字處理【數字拆解(使用method)】

Write a method that computes the sum of the digits in an integer. Use the following method header:
public static int sumDigits(long n)
For example, sumDigits(234) returns 9 (2+3+4). Use a loop to repeatedly extract and remove the digit until all the digits are extracted. Write a test program thar prompts the user to enter an inter an integer and displays the sum of all its digits.

2014年12月24日 星期三

java程式設計題目---數字處理【拆解後輸出(轉成String型態)】

設計一程式,提示使用者輸入一整數介於1~32767之間。將此整數拆解後於螢幕輸出。
例如:輸入4567,輸出4  5  6  7  。


java程式設計題目---圖形印製【三角形(2的m次方)】

設計一程式,提示使用者輸入正整數n,在螢幕上書出n層下列圖形。
例如:輸入5,輸出:
                  1
               1 2 1
            1 2 4 2 1
         1 2 4 8 4 2 1
     1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1

java程式設計題目---數字處理【排列組合】

設計一程式,提示使用者輸入兩個整數m、n,接下來從螢幕輸出最小可能(m,n)到最大可能(m,n)的組合。
例如:輸入2,4,輸出:(2,3),(3,4)

java程式設計題目---數字處理【找最小值&出現次數】

設計一程式,提示使用者輸入n個整數,計算並於螢幕顯示它們的最小值,以及最小值總共出現的次數。

java程式設計題目---數字處理【十進位轉二進位】

設計一程式,提示使用者輸入正整數n,將該數值轉換成二進位數制,並以16-bit方式於螢幕輸出結果。
例如:輸入18,輸出 0000 0000 0001 0010。

java程式設計題目---數字處理【找出第一第二高分】

設計一程式,提示使用者輸入n個分數(0~100),計算並顯示它們的最高分、第二高分於螢幕。

java程式設計題目---公式計算【費式數列】

設計一程式,提示使用者輸入正整數n,計算第n項之費式數列

2014年12月23日 星期二

java程式設計題目---數字處理【質數判斷】

設計一程式,提示使用者輸入正整數n,判斷此數是否為質數並將結果印出。

java程式設計題目---數字處理【正負數個數和總和平均】

設計一程式,提示使用者輸入多個整數,以0作為結束。分別計算這些數值中所含正數極及數個數以及它們的總和及平均,並輸出結果。

java程式設計題目---數字處理【平面座標位置判斷(圓形、圓形)】

設計一程式,提示使用者輸入兩個圓形的中心點(x,y)和半徑。判斷第二個圓形是在第一個圓形的
1. 內部
2. 重疊
3. 無相交

java程式設計題目---數字處理【平面座標位置判斷(矩形、矩形)】

設計一程式,提示使用者輸入兩個矩形的中心點(x,y)、長、寬。判斷第二個矩形是在第一個矩形的
1. 內部
2. 重疊
3. 無相交

java程式設計題目---數字處理【平面座標位置判斷(點、矩形)】

設計一程式,提示使用者輸入一個點(x,y),判斷此點是否是在中心點為(0,0)、長為10、寬為5的矩形內。

java程式設計題目---數字處理【平面座標位置判斷(點、圓型)】

設計一程式,提示使用者輸入一個點(x,y),判斷此點是否在圓心為(0,0),半徑為10的圓圈內。

java程式設計題目---公式計算【三角形類型判斷】

設計一程式,提示使用者輸入三角形的三個邊邊長,判斷此三角形為
1. 正三角形(三邊等長)
2. 等腰三角形(兩邊等長)
3. 不規則三角形(三邊等長)
4. 無法構成三角形(任意兩邊和小於或等於第三邊)

java程式設計題目---公式計算【二元一次式求解】

設計一程式,提示使用者輸入a , b , c三個實數數值,求出一元二次方程式
ax^2+bx+c=0的實根。

java程式設計題目---數字處理【平面座標位置判斷】

設計一程式,提示使用者輸入平面座標值x,y,判斷座標點所在區域並輸出適當描述。(描述該點位於1. 原點  2. X軸  3. Y軸  4. 第n象限 )

java程式設計題目---數字處理【里程計算】

設計一程式,提示使用者輸入計程車里程,並計算費用後顯示於螢幕。里程計算方法如下:
里程(公尺)              費用
<1500                       70元
>1500           每多500公尺+5元
*不足500公尺以500公尺計算

java程式設計題目---數字處理【分數分級】

設計一個程式,提示使用者輸入分數,將其分數依照不同等級由螢幕輸出。分數分級如下:
等級     分數區間
A             90~100    
B              80~89
C              70~79
D              60~69
E                0~59

java程式設計題目---數字處理【大小排序(小至大)】

設計一個程式,提示使用者輸入三個數值,將此三個數值由小至大排列後,由螢幕輸出。

java程式設計題目---數字處理【零錢兌換】

設計一個程式,提示使用者輸入金額,將此金額以100元、50元、20元、10元、5元、1元六種貨幣組合出該金額。組合方式為依照面額由大至小的順序使用貨幣,且每種貨幣的數量為無限多,無法使用100元時才能使用50元,無法使用50元時才可以使用20元,依此類推。由螢幕輸出計算結果。輸出格式為六個數字,第一個數字代表用幾個100元、第二個數字表示用幾個50元,依此類推。
例如: 輸入101,輸出: 1 0 0 0 0 1。

java程式設計題目---數字處理【三位數拆解重組】

設計一程式,提示使用者輸入一個三位數整數,計算出此數值的每個位數後,將所有位數以相反順序重新組合成整數值,並將結果列印出。
例如:輸入 123,輸出321

java程式設計題目---數字處理【三位數拆解相乘】

設計一程式,提示使用者輸入一個三位數整數,印出該數值的每個位數相乘後所得乘積數值。
例如:輸入123,輸出1 x 2 x 3 = 6。

java程式設計題目---數字處理【和差積商(浮點數)】

設計一程式,提示使用者輸入兩個實數,印出他們的和、差、積、商(結果皆印製小數點第一位)。

java程式設計題目---數字處理【和差積商】

設計一程式,提示使用者輸入兩個整數數值,以整數方式印出它們的和、差、積、商。

java程式設計題目---字母轉換【大小寫字母】

設計一個程式,提示使用者輸入一個大寫英文字母,將其轉換成小寫英文字母,並將轉換結果列印出。
例如:輸入A,輸出a。

java程式設計題目---字母轉換【數字轉字母】

設計一程式,提示使用者輸入正整數n,印出第n個小寫英文字母。
例如:輸入1,印出a
import java.util.Scanner;

public class C1 
{
 
 public static void main(String[] args) 
 {
  Scanner input = new Scanner(System.in);
  System.out.println("please enter a number:");
  int a = input.nextInt();
  
  int b = a + 96;
    
  System.out.println("The answer of the question is:" + (char)b);
 
 }

}

Go(Golang)程式語言 設定GCC

下載MSYS2:  https://www.msys2.org/ 安裝 程式開始執行後輸入: pacman -Syu y y 在安裝目錄底下找到msys2.exe,雙擊執行 輸入指令: pacman -Su pacman -S --needed base-devel mingw-...