An algorithm to print a series of nos between 1 to 100 divisible by 3 OR 7. using while loop.

1) START

2) Assign value of i=1.

3) Check is (i <=100) if TRUE then continue else GOTO step 8

4) Check if (i%3==0 || i%7==0) then continue else GOTO step 6

5) Print  value of  i

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

7) GOTO step 3

8) END

Flowchart to print a series of nos between 1 to 100 divisible by 3 OR 7.

Flowchart to print a series of nos between 1 to 100 divisible by 3 or 7.
Flowchart to print a series of nos between 1 to 100 divisible by 3 or 7.

C-Code to print a series of nos between 1 to 100 divisible by 3 or 7 using while loop.

#include<stdio.h>
void main()
{
int i=1;
while(i<=100)
    {     
     if(i%3==0 || i%7==0)
        printf("\t%d",i);
    i++;
    }  
}

C-Code to print a series of nos between 1 to 100 divisible by 3 OR 7 using for loop.

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