c language rabbit problem

A pair of rabbits from the first 3 months after birth are born every month one pair of rabbits, bunnies grow up to the third month after the month gave birth to one pair of rabbits, if the rabbit is not dead, asked the rabbit month a total of how many?

#include<stdio.h>
int main()
{
 int sum = 2;
 for (int i = 1; i <= 12; i++)
 {
  if (0 == i % 3)
  {
  sum = sum + 2;
  }
  printf("第%d月有%d个兔子\n", i, sum);
  }
  return 0}

The results show that

Published 15 original articles · won praise 0 · Views 218

Guess you like

Origin blog.csdn.net/qq_44423388/article/details/104343908