Commit b056a63f by msiita

Initial commit

parent 88ae0f88
File added
#include <stdio.h>
int main(){
int n;
printf("How many number do you want in your array?\n");
scanf("%d", &n);
//amount of numbers the user wants to input into the array
int fib[n];
fib[0]=1 ;
fib[1]=1 ;
//giving the program the first two nubmers of the sequence
int i=2;
while (i<=n)
{
fib[i]=fib[i-2]+fib[i-1];
i+=1;
}
i=0;
while(i<n)
{
if (fib[i]%2 == 0){
printf("%d is even\n", fib[i]);
i+=1;
}else{
printf("%d is odd\n", fib[i]);
i+=1;
}
}
return 0;
}
File added
#include <stdio.h>
int main(){
int n=10;
int array[n];
int i=0;
for (i = 0; i < 10; i++) {
array[i] = i+1;
}
i=0;
while(i<n)
{
if (array[i]%2 == 0){
printf("%d is even\n", array[i]);
i+=1;
}else{
printf("%d is odd\n", array[i]);
i+=1;
}
}
return 0;
}
File added
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