Sign in
Log inSign up

My code just prints an infinite loop of "1".

Gustavo Rodrigues da Silva's photo
Gustavo Rodrigues da Silva
·Feb 13, 2020

"Do a program which will read an integer number N and then will print the odd natural numbers that come before the typed number."

```#include <stdio.h>

int main(){

int n,o;

printf("Type an integer number:\n");

scanf("%d",&n);

o=1;

while(o<n){

printf("%d\n",o);

o+2;

}

} ```

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct