Message from C, C++ discussions

November 2019

— Then num should be the last number

— 

Even more simpler

register unsigned last = 0u; for(register unsigned num = 0;;++num) {last+=num; if(num + last > 100) break;  }

— reinterpret_cast

For example

#include <stdio.h>
#include <math.h>
main ()
int S;
int V;
S, V = 0;

while (!S > 100)
V = V + 1;
S = S + V;

printf ("The number is %d", V)

Message permanent page

— Can this be considered correct?

— Only I don't know where to put parenthesis

— After while

— After while() {}

— And after main() too

— #include <stdio.h>
#include <math.h>
void main ()
{
int S;
int V;
S=0,V = 0;

while (S <100)
{
V = V + 1;
S = S + V;
}
printf ("The number is %d", V);
}



Just a little edit. Might help

Message permanent page

— Thank you so much! What's void main?

— Entry point in your executable program

— Another thing. On while(S>100) should I put the "!"?