Commit 8bd73eab by makuks

Upload New File

parent ec86c5fe
Showing with 45 additions and 0 deletions
#include <stdio.h>
int main()
{
int i, n, t1 = 0, t2 = 1, t3;
printf("Enter the size of the array: ");
scanf("%d", &n);
int a[n];
printf("Fibonacci Series: ");
for (i = 0; i < n; i++)
{
a[i]=t1;
t3 = t1 + t2;
t1 = t2;
t2 = t3;
}
for (i=0; i<n; i++)
{
printf ("%d ", a[i]);
}
printf ("\n");
for (i=n-1; i>=0; i--)
{
printf ("%d ", a[i]);
}
printf("\n");
{
for (i = 0; i < n; i++)
if(a[i] % 2 == 1)
printf("%d ", a[i]);
}
printf("\n");
{
for (i = 0; i < n; i++)
if(a[i] % 2 == 0)
printf("%d ", a[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