nt main()     {      int n1=0,n2=1,n3,i,number;      printf("Enter the number of elements:");      scanf("%d",&number);      printf("\n%d %d",n1,n2);//printing 0 and 1      for(i=2;i

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.1: One-dimensional Arrays
Problem 10E: (Electrical eng.) Write a program that specifies three one-dimensional arrays named current,...
icon
Related questions
Question
  1. include<stdio.h>    
  2. int main()    
  3. {    
  4.  int n1=0,n2=1,n3,i,number;    
  5.  printf("Enter the number of elements:");    
  6.  scanf("%d",&number);    
  7.  printf("\n%d %d",n1,n2);//printing 0 and 1    
  8.  for(i=2;i<number;++i)//loop starts from 2 because 0 and 1 are already printed    
  9.  {    
  10.   n3=n1+n2;    
  11.   printf(" %d",n3);    
  12.   n1=n2;    
  13.   n2=n3;    
  14.  }  
  15.   return 0;  
  16.  }    . 

Output. 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr