SOS

0 Jorene Lim · December 9, 2014
hello there,can anyone please explain to me how to let my program run until a sentinel of 999 is entered?? For I need to convert Fahrenheit to Celsius..while loop and do-while loop respectively..

Post a Reply

Replies

Oldest  Newest  Rating
0 Jorene Lim · December 9, 2014
ok..thank you..^^ n I still got another problem..here's the question..
Design an algorithm that will prompt for and receive the time expressed in 2400 format(e.g 2305 hours),convert it to 12-hour format(e.g 11.05pm) and display the new time to the screen.Your program is to repeat the processing until a sentinel time of 9999 is entered.
0 Bernard Pyc0d333 Parah · December 9, 2014
for while loop

int sentinel;


while(sentinel!=999)
{
statement; //whatever you want to run will keep running till the user enters 999
}

using the do while loop

int sentinel;
do
{
statement;
}

while (sentinel !=999);
0 Bernard Pyc0d333 Parah · December 9, 2014
Hello Jorene. Though your question is vague.
For the sentinel you can set it thus

for while loop
<pre>
 int sentinel;


while(sentinel!=999)
{
    statement; //whatever you want to run will keep running till the user enters 999
}
</pre>

using the do while loop
<pre>
    int sentinel;
 do
{
  statement;
}

while (sentinel !=999);

</pre>
  • 1

C

106,938 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator