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 で フィボナッチ数列 で遊ぶ

Last updated at Posted at 2024-12-28

参考

o_coq697.jpg

x arduinoでの予定は、未定

目的
主に整数の足し算のベンチマークに使われるので遊んでみる

値として次なら正解


0,1,1,2,3,5,8,13,21,34,55,

オンラインコンパイラ


#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    printf("\nchk\n");
    printf("0,1,1,2,3,5,8,13,21,34,55,\n\n");
    
    
    int a = 0;
    int b = 1;
    int c;
    
    printf("exe\n");
    printf("%d,",a);
    printf("%d,",b);
    
    for(int i=0;i<9;i++){
        
        //printf("[%d]:",i);
    
        c = a + b;
        printf("%d,",c);
    
        a = b;
        b = c;
    
    }//for
    
    
}//main




chk
0,1,1,2,3,5,8,13,21,34,55,

exe
0,1,1,2,3,5,8,13,21,34,55,


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?