answersLogoWhite

0


Best Answer

#include<stdio.h>

int main () {

int odd=1;

int count=0;

while (count++<10) {

printf (%d\n", odd);

odd+=2;

}

return 0;

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

You write a loop, and use the counter variable. A forloop is very appropriate in this case. The System.out.println(...) method is appropriate for printing.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you write a c program using while loop that will print first ten odd numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you print from compaq laptop?

Use the option File / Print in the program you are using.


How can you accept sum and print numbers without creating variables?

It is very easy. The program begins here..... /*Program to sum and print numbers without creating variables*/ #include&lt;stdio.h&gt; main() { clrscr(); printf("%d+%d=%d",5,2,5+2); getch(); } /*Program ends here*/ Now just by changing the numbers in the "printf" statement we can add, subtract, multiply and divide the numbers without using variables. Hence the problem is solved..........


How do you get to 9 using 123456789 - plus using numbers and symbols only once?

-- Photocopy the question or print the screen. -- Trim and discard the first 8.


2 Write a program to print a following program?

USING STRING LITERAL VALUES TO ADD 2 NUMBERS If you just want to show the outcome of two numbers you have: PRINT 4 + 5 This will print '9' the answer to 4 + 5. If you want to show the addition: PRINT "4 + 5 = "; 4 + 5 This will show the question and then calculate the answer. If you want the user to input numbers to add, use variables and then add them the same way. ====== COLLECTING USER INPUT FROM THE KEYBOARD/USING NUMERIC VARIABLES In the following example, the end user can get to interact with the program by typing in their numbers at the keyboard; then, pressing the [Enter] key. CLS PRINT "PROGRAM: Add 2 numbers" PRINT INPUT "Enter the 1st number: ", number1 INPUT "Enter the 2nd number: ", number2 PRINT sumTotal=number1+number2 PRINT "The sum total is: "; sumTotal PRINT INPUT "Again, Y/N"; yesNo$ IF UCASE$(LEFT$(yesNo$,1))="Y" THEN RUN END ====== CREATE FUNCTION/THEN, MAKE A FUNCTION CALL TO ADD 2 NUMBERS Another way to write this program is to create a function/then, make a function call... '*** PROGRAM: Add 2 numbers... '*** Variable declaration list... number1=7 '...initialise numeric variable 1 number2=3 '...initialise numeric variable 2 '*** Main program... CLS '...(CL)ear the (S)creen PRINT add(number1,number2) '...make function call/passing in 2 numbers to add END '...END of program/halt program code execution '*** Function(s)... FUNCTION add(num1,num2) '...this line marks the start of the Function add=num1+num2 '...this line returns the sum total of the 2 numbers END FUNCTION '...this line marks the end of the Function


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


Write a program to Print pyramid of numbers using java?

hi question is here, 1 1 2 1 2 3 1 2 3 4


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Write a c or c plus plus program to print first 50 odd numbers using do while loop?

unsigned count = 0;unsigned num=1; do { std::cout &lt;&lt; num &lt;&lt; std::endl; num +=2; } while (++count&lt;50);


Write a FORTRAN program using if statement to calculate the smallest of three numbers xyz?

N = x If y &lt; N then N = Y If z &lt; N then N = z Print N


Write a program in qbasic to make a hut using print statemant?

a triangle then a square :)


How do you print strings and numbers in single statement by using C language?

With printf.Example:for (i=0; i