Re: Hey guys little prob



> I want to know why the program is printing the numbers twice on the screen.

Strange question...

> #include<stdio.h>
> int main()
> {
> float n[100]={10,20,30,40,50,60,70,80,90,100}, sum=0.0;
> int i;
>
>
> for(i=0; sum<=100.0; i++)
> {
> sum=sum+n[i];
>
> if (sum<=100.0)
> {printf("%.1f \n", n[i]);}
> else
> n[i]=-1;
> {printf("%.1f \n", n[i]);}
^^^^^^^^^^^^^^^^^^^
Have you thought of this line?

mazsx

.



Relevant Pages

  • Re: [C] problem displaying string
    ... character and printing it with the %d format. ... >typedef struct bigint { ... >int main ... > bigint nines, subtrahend, diff; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: offscreen rendering in Linux
    ... I'm trying to get printing my OpenGL scenes of aUCBLogo to work ... Instead of a Pixmap use a PBuffer. ... int scrnum = DefaultScreen; ...
    (comp.graphics.api.opengl)
  • Re: Time to ask?
    ... I am using X-code to compile this....not sure if this has anything ... int getch; ... so I have to assume that it isn't hanging. ... Printing line 1 ...
    (comp.lang.c)
  • Re: game of life
    ... > int config = s.nextInt; ... setting up a board configuration ... printing the next generation ... you initialize the increment counter within the loop, ...
    (comp.lang.java.programmer)
  • Re: How it works?
    ... The following code is working fine and printing the string "Mohan S". ... int main ...
    (comp.lang.c)