Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

While loop C language HELP!

ericute09

Recruit
Basic Member
Messages
6
Reaction score
0
Points
16
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 quotient.

#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;
}
thanks po sa tutulog
 
change

float n=190; -> int n=190; // It doesn't need to be float.
inside your loop
c=n; //Declaring a value to our c variable
printf("%d ",n); //Printing the value of variable n Note: don't forget the space. %d denotes integer.
n++; //increment
c=c/n; //Getting the quotient of the variables c and n base on their current value.
printf("%f",c);

Di ako sigurado kung tama to just compile na lang. Turbo C was my first programming language that i learn way back 2010 so can't seem to identify kung mag run yan smoothly. Kung may errors just correct and apply the logics na lang sa mga comments.

Press thanks if it helps.
 
Last edited:
hehehe tama yung sa taas ng comment ko.
walang akong app na C++ ngayun pero sure ako mag declare ka muna ng value sa "c" variable para magamit mo wag mo divide agad2
 
Back
Top Bottom