Commit 65e908af by chazog

Upload New File

parent 9491a340
Showing with 48 additions and 0 deletions
#include <stdio.h>
int main () {
int i, n, t1=0, t2=1, nT;
printf("Enter the number of terms: ");
scanf("%d", &n);
int numberArray[n];
printf("Fibonacci Sequence is: ");
for (i=0; i< n; ++i)
{
printf("%d, ", t1);
numberArray[i]=t1;
nT= t1 + t2;
t1 = t2;
t2 = nT;
}
for (i=0; i<n; i++){
if (numberArray[i]%2==0)
{
printf("\nThe even numbers are: %d\n", numberArray[i]);
}
else {
printf("The odd numbers are: %d\n", numberArray[i]);
}
}
printf("the numbers backwards are:");
for (i=n-1; i>=0; i--){
printf("%d ", numberArray[i]);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment