【发布时间】:2020-11-24 18:15:04
【问题描述】:
我需要将这个小for 循环翻译成while 循环,我该怎么做?
void count_the_numbers(int array[]){
printf("\n");
int i = -1;
while(i < 4){
int count = 1;
i++;
for(int j=0; j < 5; j++){
if(i != j && array[i] == array[j])
count++;
}
printf("Number %d is %d times in this array/e\n", array[i],
conteggio);
}
}
这是另一个循环,它给我的结果与前一个不同
【问题讨论】:
-
您可以查找
for循环的定义。for (A; B; C) { D;}与A; while (B) {D; C; }相同
标签: c