🔒 Closed While loop in c language

Status
Not open for further replies.

Attachments

  • Screenshot (114).webp
    Screenshot (114).webp
    117.9 KB · Views: 12
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 (E×ρréššed in exponent form): %0.30lg\n", quotient);
    printf("                                             ----------------------------------\n");
    printf("\nFINAL QUOTIENT (E×ρréššed in decimal form):  %0.30lf\n", quotient);
    printf("                                             ----------------------------------\n");
    return 0;
}
 
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 (E×ρréššed in exponent form): %0.30lg\n", quotient);
    printf("                                             ----------------------------------\n");
    printf("\nFINAL QUOTIENT (E×ρréššed in decimal form):  %0.30lf\n", quotient);
    printf("                                             ----------------------------------\n");
    return 0;
}
Thankyou boss Ng marami😊
 
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

  • quotient.webp
    quotient.webp
    14.3 KB · Views: 13
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,006
Guests online
723
Total visitors
1,729

Forum statistics

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