다음 코드를 준수하십시오. 그 양을 배열의 마지막 요소 값으로 나누고 싶습니다. 다음과 같은 방법으로 시도했지만 작동하지 않습니다. 아무도 그것을 할 수있는 적절한 방법이 무엇인지 말해 줄 수 있습니까? noteNumber
만약배열의 마지막 요소 값을 얻는 방법은 무엇입니까?
#include<stdio.h>
int main()
{
int i, j, k, noteNumber, array[100], amount, result;
printf("Enter the number of the notes: \n");
scanf("%d", ¬eNumber);
printf("Enter the value of %d notes: \n", noteNumber);
for(i = 0; i < noteNumber; i++){
scanf("%d", &array[i]);
}
printf("Enter the amount: \n");
scanf("%d", &amount);
i = j;
if(amount/array[j] == 0){
printf("Minimum %d number of is needed", (amount/array[j]));
printf("The value of each note is %d", array[j]);
}
}
'양/배열 [noteNumber-1]' – George
는 "이 작동하지 않습니다"정의된다. 예상보다 다른 출력을 얻습니까? 그렇다면 입력 한 내용, 예상 한 결과 및 실제로 얻은 결과가 질문에 대한 추가 사항입니다. –
마지막 요소는 배열 [noteNumber - 1]이됩니다. 문제를보다 명확하게 정의하고 솔루션에서 "작동하지 않는"것이 무엇인지 알려주는 것이 도움이 될 것입니다. –