Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?
Answers were Sorted based on User's Feedback
Answer / nipun
#include<stdio.h>
#include<conio.h>
void main()
{
int var;
int count=0;
int n=0;
clrscr();
while(n<10)
{
printf("Enter the number:");
scanf("%d",&var);
if(var%2 == 0)
{
count++;
n++;
}
else
{
n++;
continue;
}
}
printf("Even numbers present:%d",count);
getch();
}
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / sansiri
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=0;
int count=0;
printf("\n Enter the 10 integer numbers");
while(i<10)
{
scanf("%d",&n);
if(n%2==0)
{
count++;
}
i++;
}
printf("\nCount of even numbers:%d",count);
getch();
}
printf
| Is This Answer Correct ? | 4 Yes | 1 No |
which typw of errors ? & how to solve it ?
UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
what is syntax error?
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
What are the different types of errors in C and when they occur?
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
What is the code for following o/p * * * * * * * * * * * * * * * *
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.