What's new

Closed While loop in c language

Status
Not open for further replies.
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?
Not exactly,

C:
#include <stdio.h>

int main(void) {
    printf("Sizeof int: %d\n", sizeof(int));
    printf("Sizeof float: %d\n", sizeof(float));
    printf("Sizeof double: %d\n", sizeof(double));
    return 0;
}

Sir, baka double yung ibig mong sabihin?
 
Eto sample code, it displays the quotient in both exponent and decimal form. Sa exponent form, it shows the value: 7.4918451579688896171440390924e-19

C:
#include <stdio.h>

int main(void) {
    double DIVIDEND = 190;
    double DIVISOR = 181;
    double quotient = DIVIDEND;
    printf("\nProgram that divides number from 190 to 181\n");
    printf("===========================================\n");
    while (DIVIDEND>DIVISOR) {
        quotient /= --DIVIDEND;
    }
    printf("\nFINAL QUOTIENT (expressed in exponent form): %0.30lg\n", quotient);
    printf("                                             ----------------------------------\n");
    printf("\nFINAL QUOTIENT (expressed in decimal form):  %0.30lf\n", quotient);
    printf("                                             ----------------------------------\n");
    return 0;
}
 
Last edited:
Eto sample code, it displays the quotient in both exponent and decimal form. Sa exponent form, it shows the value: 7.4918451579688896171440390924e-19

C:
#include <stdio.h>

int main(void) {
    double DIVIDEND = 190;
    double DIVISOR = 181;
    double quotient = DIVIDEND;
    printf("\nProgram that divides number from 190 to 181\n");
    printf("===========================================\n");
    while (DIVIDEND>DIVISOR) {
        quotient /= (DIVIDEND-1);
        DIVIDEND--;
    }
    printf("\nFINAL QUOTIENT (expressed in exponent form): %0.30lg\n", quotient);
    printf("                                             ----------------------------------\n");
    printf("\nFINAL QUOTIENT (expressed in decimal form):  %0.30lf\n", quotient);
    printf("                                             ----------------------------------\n");
    return 0;
}
Thankyou boss Ng marami😊
 
Last edited:
solve ko na problem mo. pero magkaiba ang output. saan galing ang 7.49 mo.


pakilagay na lang question galing sa professor/professora niyo para maliwanagan kaming lahat.
Reverse loop po din magdidivide ang loop at ilabas ang quotient example po ang loop is
190 to 181
190/189/188/187/186/185/184/183/182/181=(quotient).
Pagpinagdivide mo boss Yan using calculator lalabas 7.4918.. and so on . Using while loop
 
Reverse loop po din magdidivide ang loop at ilabas ang quotient example po ang loop is
190 to 181
190/189/188/187/186/185/184/183/182/181=(quotient).
Pagpinagdivide mo boss Yan using calculator lalabas 7.4918.. and so on . Using while loop
To put it more accurately, 7.4918^-19 which is 7.4918 preceded by decimal 19 zeros.
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top