What's new

Closed While loop in c language

Status
Not open for further replies.

PHcShiroe

Honorary Poster
Joined
May 8, 2015
Posts
149
Reaction
198
Points
129
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;
}
 
Last edited:
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=?
 
Last edited:
#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.png
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top