Write an algorithm to display first 10 odd numbers using for loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hassan1914
    New Member
    • Oct 2019
    • 1

    Write an algorithm to display first 10 odd numbers using for loop

    Write an algorithm to display first 10 odd numbers using for loop
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    Follow the posting guidelines and mention what you've done so far for this.

    Comment

    • AjayGohil
      New Member
      • Apr 2019
      • 83

      #3
      hello try this using for loop

      Code:
      #include<stdio.h>
      #include<conio.h>
       
      void main()
      {
            int max,i;
            printf("Enter value of max");
            scanf("%d",&max);
            printf("Odd Numbers : \n");
            for(i=0;i<=max;i++)
             {
                 if(i%2==1)
                   printf("%d",i);
             }
       
      }

      Comment

      • SioSio
        Contributor
        • Dec 2019
        • 272

        #4
        Set to initial value 1 and increment 2
        Code:
        for(i=1;i<=19;i+=2)

        Comment

        • dev7060
          Recognized Expert Contributor
          • Mar 2017
          • 656

          #5
          Reason for asking the progress is to see what they have tried so far. And that's how things work in the profesional IT environment. Nonetheless, one can easily find tons of working code snippets on the web for these basic questions.

          Comment

          Working...