By this month into a rabbit = last month into a rabbit + month rabbit; this month bunny = last month cub; this month's Bunny = Rabbit this month
Using the While loop:
Console.WriteLine ("Please enter the month:");
int m = Int. Parse (Console.ReadLine ());
int ct = 0;
int XT = 0;
int YT = 1;
int ZT = 1;
int i = 1;
while (I<=M)
//{
if (i = = 1)
// {
ct = 0;
XT = 0;
YT = 1;
// }
Else
// {
CT = ct + xt;
XT = YT;
YT = ct;
// }
ZT = ct + xt + YT;
i++;
//}
Console.WriteLine ("First" + M + "months into the rabbit logarithm is:" + ct);
Console.WriteLine ("The first" + M + "months of the small rabbit logarithm is:" + XT);
Console.WriteLine ("s" + M + "months of the young rabbit logarithm is:" + YT);
Console.WriteLine ("The first" + M + "months of the total rabbit logarithm is:" + ZT);
Take advantage of A For loop:
Console.WriteLine ("Please enter the month:");
int M=int. Parse (Console.ReadLine ());
int ct = 0;
int XT = 0;
int YT = 1;
int zt=1;
for (int i = 1; I <= m;i++)
// {
if (i = = 1)
// {
ct = 0;
XT = 0;
YT = 1;
// }
Else
// {
CT = ct + xt;
XT = YT;
YT = ct;
// }
ZT = ct + xt + YT;
//}
Console.WriteLine ("First" + M + "months into the rabbit logarithm is:" + ct);
Console.WriteLine ("The first" + M + "months of the small rabbit logarithm is:" + XT);
Console.WriteLine ("s" + M + "months of the young rabbit logarithm is:" + YT);
Console.WriteLine ("The first" + M + "months of the total rabbit logarithm is:" + ZT);
C-Language Classic topic-Rabbit born Rabbit