What's new

Closed Loops in C Language

Status
Not open for further replies.

D3V0N

Eternal Poster
Joined
Apr 22, 2015
Posts
602
Reaction
614
Points
275
Age
23
Hi mga paps, heto nanaman ako upang magpatulong sa mga pro users of c language jan, medyo confused pa po ako sa loops kaya sana matulungan nyo ko

I need po a loop na magtatanong if you want to process another that is answerable by "Y or y" and "N"/n"
Then pag ang ininput ng user is no,dapat mag didisplay ng total charge of the day(meaning naipon nya yung data ng mga charges) tas ididisplay din yung total transactions on that day


Screenshot_20190902-072731.png
 

Attachments

Hindi ba dapat if else statement pag ganyan? Tapos pag No yung input ng user, doon iloloop yung mga nakuhang data
 
bali 'yung '5' sa TOTAL NO. OF TRANSACTION ang gamitin natin na variable counter, then ilagay mo sa array 'yung mga napiling item

C:
// pass var 5 to i , hindi nakahardcode

int i = 5; // palitan na lang 'yung 5 ng kung ano variable mo or do it directly sa for loop

for(int a = 1; a <= 5; a++) {

    printf("%s\n", chosenItemName[a]);

}
 
Last edited:
Hi mga paps, heto nanaman ako upang magpatulong sa mga pro users of c language jan, medyo confused pa po ako sa loops kaya sana matulungan nyo ko

I need po a loop na magtatanong if you want to process another that is answerable by "Y or y" and "N"/n"
Then pag ang ininput ng user is no,dapat mag didisplay ng total charge of the day(meaning naipon nya yung data ng mga charges) tas ididisplay din yung total transactions on that day


View attachment 676551


So hindi sayo yang nasa attachment mo? kasi tama naman yung nasa attached mo na SS. If not yours, then read about program flow statements like if, ifelse, nested if, switch and goto statement. Makakatulong sayo yan.
 
Explore "while" or "do while" loops.

And please post your code. Don't be embarrassed even if the code is not working or else we will end up doing the whole project or assignment for you.

Which would defeat the purpose of why the teacher gave that to you. ;)
 
Status
Not open for further replies.
Back
Top