백준 1003 피보나치함수

Console Programming/C# Console 2019. 10. 30. 09:08
using System;

public class Test
{
	public static void Main()
	{
		int tescase = int.Parse(Console.ReadLine());
		for (int j = 0; j < tescase; j++)
		{
			int input = int.Parse(Console.ReadLine());
			wtf(input);
		}
	}
	
	static void wtf(int i)
	{
		int temp1=0;
		int temp2=1;
		int num=0;
		
		if (i == 0)
			Console.WriteLine("1 0");
		else if (i == 1)
			Console.WriteLine("0 1");
		else
		{
			for(int k=0; k<i-1; k++)
			{
				num=temp1 +temp2;
				temp1 =temp2;
				temp2 =num;
			}
			Console.WriteLine("{0} {1}", temp1, temp2);
		}
	}
}

 

 

: