Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 3 Part 1 v2
//gcc 5.4.0 #include <stdio.h> #include <stdlib.h> //Start Program //int n //int i //int f [0,1] //READ n //for(i=0;i<=n;i++){ // if(i%2==0) // f1=f1+f2; // printf("%d,",f1) // } //// if(i%2!==0){ // f2=f1+f2; // printf("%d,",f2); // } //} //End Program int main(void) { int n; int i; int f1=0; int f2=1; scanf("%d",&n); if(n>0){ for(i=0;i<=n;i++){ if(i<=0) printf("0,"); else if(i%2==0){ f1=f1+f2; printf("%d,",f1); continue; } else if(i%2!=0){ f2=f1+f2; printf("%d,",f2); continue; } } } else if(n<0){ n=n*-1; for(i=0;i<=n;i++){ if(i<=0) printf("0,"); else if(i%2==0){ f1=f1+f2; printf("%d,",f1*-1); continue; } else if(i%2!=0){ f2=f1+f2; printf("%d,",f2); continue; } } } else{ return 0; } }
run
|
edit
|
history
|
help
0
Spring 2017 Project 2 v1
advanced string manipulation
finalpyramid
tremendo codigaso ayudantia
Lab 7 blackjack v1.1
B_141121_factorial02
Run code before/after main in C (GCC)
MinMaxArray
B_141202_Cadenas01
32bit