An algorithm to print  odd  number from 1 to 50 using while loop.

1) START

2) Initialize loop counter i=1

3) Check is i<=50 if TRUE then continue ELSE Goto Step 8

4)  Check is i%2 = = 1 if TRUE then continue ELSE GOTO Step 6

5) Print Value of i

6) Increment value of i by 1 i.e i++

7) GOTO Step 3

8) END

Flowchart to print  odd  number from 1 to 50 using while loop.

Flowchart to print odd number from 1 to 50 using while loop .
Flowchart to print odd number from 1 to 50 using while loop .

C Program to print odd number between 1 to 50 using while loop.

#include<stdio.h> void main() { int i; i=1; while(i<=50) { if(i%2==1) printf(“\n %d”,i); i++; } }

C Program to print odd number between 1 to 50 using do…while.

#include<stdio.h>
void main()
{
int i;
i=1;
do
   {  
      if(i%2==1)
      printf("\n %d",i);
      i++;

    }while(i<=50);
}

C-Code to print  odd  number from 1 to 50 using for loop .

#include<stdio.h>
void main()
{
int i;
for(i=1;i<=50;i++)
    {
    if(i%2==1)
    printf("\n %d",i);
    }
}