Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Exercise1 {
- public static string test(int range) {
- string ans = "";
- int first = 0, second = 1, fibonicci = 0;
- for (int c = 0; c < range; c++) {
- if (c <= 1) {
- fibonicci = c;
- ans += (fibonicci.ToString()) + " ";
- } else {
- fibonicci = first + second;
- first = second;
- second = fibonicci;
- ans += (fibonicci.ToString()) + " ";
- }
- }
- return ans;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement