🔒 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,036
Guests online
740
Total visitors
1,776

Forum statistics

Threads
2,280,385
Posts
28,996,963
Members
1,225,773
Latest member
cycy22
Back
Top