分别用while ,do-while,for语句求出前20项和
分别用while ,do-while,for语句求出前20项和
日期:2018-03-14 19:47:30 人气:1
#include
void main()
{
int i = 2;
int j = 1;
int k = 0;
int t;
double sum = 0;
// 注释:1.while
while(k < 20)
{
sum += (double)i/j;
if (k < 19)
printf("%d/%d + ", i, j);
el