I am running this program
#include <stdio.h>
int main ()
{
int n;
int a = 1;
int b = 2;
int product;
int i;
printf("How many numbers of the sequence would you like \n");
scanf("%d",&n);
for (i=0;i<n;i++)
{
printf("%d\n",a);
product = a * b;
a = b;
b = product;
}
return 0;
}
When I enter n = 3, the result is 1 2 2
Why is it ? I meant to make it so it show 1 2 4 , what have I done wrong ? And why is it print 1 2 2 .