🔒 Closed Pa help po 1st year college plng ako

Status
Not open for further replies.

If Else

Established
Alam kung basic lng to sa inyu
 

Attachments

  • Screenshot_2021-10-07-09-59-45-78_e46acc4301d552178f1fc7f923d8665c.webp
    Screenshot_2021-10-07-09-59-45-78_e46acc4301d552178f1fc7f923d8665c.webp
    37.8 KB · Views: 32
Step 1
use loop to print value of x and count.
set the initial value of x=6 and value of count=4.
display value of x and count.
if( value of x==8 )
x=x+2, count=count-2
otherwise x++,count--
end.
Step 2
#include <stdio.h>
int main()
{
int x=6, count=4;
while(1)
{
printf("\nx is %d and count is %d",x,count);
if(x==8)
{
x=x+2;
count=count-2;
printf("\nx is %d and count is %d",x,count);
break;
}
x++;
count--;

}
return 0;
}

840-271f-11ec-a5e9-2332dbb6d412_Screenshot%20(718).webp
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 422
    Views
  • 2
    Participants
Last reply from:
vai_youth25

Online now

Members online
1,126
Guests online
1,662
Total visitors
2,788

Forum statistics

Threads
2,277,063
Posts
28,974,089
Members
1,229,713
Latest member
heizy
Back
Top