이 질문에 대해 유감이지만 다른 곳으로 갈 곳이 없으며 해결 방법을 찾을 수 없습니다. 저는 Pascal 프로그래밍 언어에 익숙합니다. 그래서이 C 언어는 저에게 익숙한 것처럼 보이지만 while 루프의 전체 구조를 변경하는 if 함수를 추가하는 것은 저에게 너무 복잡합니다. 제발 도와주세요.안녕하세요, 누군가이 루프로 나를 도울 수 있습니까
The array variable consists of a sequence of ten numbers. Inside the while loop, you must write two if conditions, which change the flow of the loop in the following manner (without changing the printf command):
- If the current number which is about to be printed is less than 5, don't print it.
- If the current number which is about to be printed is greater than 10, don't print it and stop the loop.
Notice that if you do not advance the iterator variable i and use the continue derivative, you will get stuck in an infinite loop.
#include <stdio.h>
int main()
{
int array[] = {1, 7, 4, 5, 9, 3, 5, 11, 6, 3, 4};
int i = 0;
while (i < 10)
{
/* your code goes here */
printf("%d\n", array[i]);
i++;
}
return 0;
}
Java, C++ 및 Pascal 태그가 필요한 이유는 무엇입니까? –
당신은'continue'와'break'에 익숙합니까? –
C에 익숙하다면'if'와'break'에 익숙 할 것입니다. –