answersLogoWhite

0


Best Answer

#include<stdio.h>

main()

{

int a,i=1;

printf("Enter max no");

scanf("%d",&a);

do

{

printf("%d",i);

i=i+2;

}while(i<=a);

}

User Avatar

Wiki User

โˆ™ 12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

โˆ™ 11y ago

main()

{

int n,i=1;

printf("Enter the Number till you want to print even numbers");

scanf("%d",&n);

printf("Even Numbers till %d are",n);

while(i

{

if((i%2)==0)

printf("%d",i);

i++;

}

}

OR

main()

{

int n,i=1;

printf("Enter the Number till you want to print even numbers");

scanf("%d",&n);

do

{

if(i%2==0)

printf("%d",i);

i++;

}while(i

}

OR

void main()

{

int i=0,n;

printf("Enter the number till you want to print even numbers:");

scanf("%d",&n);

do

{

printf("%d\t",i);

i+=2;

}while(i<=n);

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do while loop program in c for printing odd numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you loop a program in python 3?

A program can be looped in Python by wrapping the entire program in a for or while loop. If you wish to loop the program a finite amount of times, it can be done like so (x = the amount of times you want it to loop, this can be a number or variable storing a number): for i in range(0,x): [code] If you wish to loop the program infinitely, you can use a simple while loop: while True: [code]


Write a program using while loop?

//program to find the factorial value f any number using while loop #include&lt;stdio.h&gt; void main() { int i,n,fact=1; printf("Enter the number\n"); scanf("%d",&amp;n); i=n; while (i&gt;=1) { fact=fact*i; i--; } printf("The factorial value=%d",fact); } the above is a program for calculating tha factorial value of any number which is entered by the user


How do you write a program with do while loop so that the output is 123456 equals 720?

How do you write a program with do while loop so that the output is 123456 =720


How can you write a c program using while loop that will print first ten odd numbers?

#include&lt;stdio.h&gt; int main () { int odd=1; int count=0; while (count++&lt;10) { printf (%d\n", odd); odd+=2; } return 0; }


What are the disadvantages of the While Loop?

With loops, your program is slower.


C program to print numbers 1 to n?

how do we use loops in c plus plus programing and what are basic differences between do,for and while loop


What loop should no execute if the test expression is false to begin with?

for loop and while loop need the expression to be true for further execution of the program.


Do while loop sum of n numbers write a c program?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int a=n; do {for("a&lt;=n",%d); while {for ("a=n",number); getch(); }


C program algorithm for simple interest using while loop?

Not used


How do you loop a program in python?

An infinite loop might look something like: while 1==1: print("Infinite loop") as 1 is ALWAYS equal to 1.


Write a program that will graph using for loop?

A = 5do{statement;A = A + 1;} while (A < 10)


Sum three real numbers using for loop in c program?

take input n chodo