answersLogoWhite

0


Best Answer
#include#includevoid main()int n;printf("enter any number");scanf("%d",&n);while(n%2==0)printf("enter the number is even");elseprintf("enter the number is odd");}getch()
User Avatar

Wiki User

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

Wiki User

12y ago

/* write a c program to sum even number by getting input from user*/

#include <iostream.h>

int main(void)

{

int num = 1;

int sum = 0;

int upperlimit;

printf("Enter the upperlimit:");

scanf("%d", &upperlimit);

while( num <= upperlimit)

{

if(num % 2 == 0)

{

sum += num;

num += 1;

}

}

printf("The sum of the even num is 5d\n", sum);

return 0;

}

Above is my code to determine even number sum i dont know what is error in it i have try to remove the error but program execute well didn't display the required result....

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

void main() { int i=0; printf("Even numbers in: [0,20]"); while(i<=20) { printf("%d\t", i); i += 2; } }

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include<stdio.h>

main()

{

int i=1;

while(i<=20)

{

printf("%d",i);

i=i+2

}

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Following for whole numbers....

If number mod 2 Then

add code for even number

Else

add code for odd number

End If

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

Something like this:

int i = 1;

while (i <= 100) {

System.out.print(i, ' ');

i+=2;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java program to print odd numbers using while loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a c program to print n no's required using while loop?

int i=0; while (i++&lt;n) { /*...*/ }


How can we print a book using google print?

"While it is possible to use this program to print a book, it is highly recommended to print it with an actual publisher. You will get a much better deal and your book will look a lot more professional."


Write a c program to print the 100 to 1 nos?

Write a c program to print the 100 to 1 nos


How do you print the numbers 1 through 50 using a do-loop while statement in Visual Basic.NET?

x as int = 0 while x &lt; 50 x = x + 1 print x endwhile


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);


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


A program prints vertically a numbers in c program?

It is too easy................ //Program to print numbers vertically #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int last_no; int i; clrscr(); i=0; printf("Enter your last num.I will print 0 to that number"); scanf("%d",&amp;last_no); printf("\n"); while(i&gt;last_no) { printf("%d\n",i); i++; } getch(); } //poo.papule


How to draw Flowchart to print prime numbers from 1 to 100 using while loop in c language?

c the book mastering c


Write a program in c plus plus to print all odd numbers between 1 to 100?

#include &lt;iostream&gt; using namespace std; int main() { int i=1; do { if( i%2 ) cout&lt;&lt;i&lt;&lt;" "; } while( ++i&lt;100 ); cout&lt;&lt;endl&lt;&lt;endl; return(0); }


Is it possible to make a program using for and not with while?

The following cases are all possible:- program without any for and while- program without for- program without while- program with both for and while


WAP To print the squares of all even numbers from 1 to 20?

CLS PRINT "PROGRAM: Print squares of all even numbers from 1 to 20" PRINT PRINT "number", "squared" PRINT FOR number% = 1 TO 20 IF number% MOD 2 = 0 THEN PRINT number%, number% * number% END IF NEXT END


Can someone make you a while statement program that will calculate the squares of all the numbers from 10 to 50?

10 N = 1020 WHILE N < 5130 S = N^2 : Print N, S40 N = N + 150 WEND