1 条题解

  • 0
    @ 2021-6-15 10:11:06

    C :

    #include<stdio.h>
    int main()
    {
    	int a1,a2,i,a3;
    	a1=0;a2=1;
    	printf("%d %d",a1,a2);
    	for(i=3;i<=21;i++)
    	{
    		a3=a1+a2;
    		printf(" %d",a3);
    		a1=a2;
    		a2=a3;
    	}
    	return 0;
    }
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
      int a=0,b=1,c;
      cout<<a<<" "<<b;
      for (int i=1;i<=19;++i)
        {
          c=a+b;
    		cout<<" "<<c;
    		a=b;b=c;
         }
    	return 0;
    }
    

    Pascal :

    program ex_1;
    begin
     writeln('0 ','1 ','1 ','2 ','3 ','5 ','8 ','13 ','21 ','34 ','55 ','89 ','144 ','233 ','377 ','610 ','987 ','1597 ','2584 ','4181 ','6765');
    
    end.
    
    
    
    
    
    
    
    
    
    
    
    
    
    • 1

    信息

    ID
    380
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者