1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Arduino UNO 3で合計を取って遊ぶ

Posted at

Arduino UNO 3で合計を取って遊ぶ

●なんやこれーーーー ムズイ ムズイ

o_coq366.jpg

いろいろ
アルゴリズム的には、単位半分くらいでドラクエ1的には、レベル55
最終章は、ソート レベル的には99

結果

o_coq367.jpg

プログラム




//初期化
// the setup routine runs once when you press reset:
void setup() {

  //シリアルポートの初期化
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);

}//setup



#define n 10

//メインループ
// the loop routine runs over and over again forever:
void loop() {

  int x[n + 1];

  x[1] = 1; x[2] = 2; x[3] = 3; x[4] = 4; x[5] = 5;
  x[6] = 6; x[7] = 7; x[8] = 8; x[9] = 9; x[10] = 10;

  int z = 0;
  for (int k = 1; k <= n; k++) {

    z = z + x[k];

  }//for

  //結果の表示
  // print out the value you z:
  Serial.println(z);
  delay(1000);        // delay in between reads for stability

}//loop


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?