🔒 Closed While loop in c language

Status
Not open for further replies.

PHcShiroe

Enthusiast
Pa Help po di ko po magawa kung pano mag divide at makuha yung sagot sa loop.
like for example po 181 to 190 but reverse po ang loop. 190\189\188\187...\181 then maprint po yung answer.

#include<stdio.h>
#include<conio.h>

int main()
{
clrscr();
float n=190;
float c;
while(n>=181)
{
c=c/n;
printf("%f\n",n--);
}
printf("%f",c);
getch();
return 0;
}
 
huwag kang gumamit ng float. mas malaki ang allocation niya compared sa int.
int n = 190;
while(n >= 181)
printf("%d%c", n," ");
n--;
)

paki linaw po ang division. ang ba gusto mong output talaga?
 
#include<stdio.h>
#include<conio.h>

int main()
{
clrscr();
float c1;
float n=190.00;
float c=189.00;
while(n>=181)
{
c1=n/c;
printf("%f\n",n--,c--);

printf("%f\n",c1);

}

getch();
return 0;
}
 
huwag kang gumamit ng float. mas malaki ang allocation niya compared sa int.
int n = 190;
while(n >= 181)
printf("%d%c", n," ");
n--;
)

paki linaw po ang division. ang ba gusto mong output talaga?
decimal po boss ang sagot kaya float ginamit ko .
ang gusto ko po na output is yung quotient po ng loop which is 7.49
190/189/188/187/186/185/184/183/182/181=?
 
#include<stdio.h>
#include<conio.h>

int main()
{
clrscr();
float c1;
float n=190.00;
float c=189.00;
while(n>=181)
{
c1=n/c;
printf("%f\n",n--,c--);

printf("%f\n",c1);

}

getch();
return 0;
}
Boss yung sa output po yung quotient ng 190/189/188/187/186/185/184/183/182/181=?
 
jjjjj.webp
 
Status
Not open for further replies.

About this Thread

  • 32
    Replies
  • 1K
    Views
  • 4
    Participants
Last reply from:
homer_simpson

Trending Topics

Online now

Members online
1,181
Guests online
861
Total visitors
2,042

Forum statistics

Threads
2,280,423
Posts
28,997,182
Members
1,225,793
Latest member
bhzinxz
Back
Top