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 |
How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.
Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10
what is run time error?
I'm having trouble with coming up with the correct code. Do I need to put a loop? Please let me know if I'm on the right track and what areas I need to correct. I still don't have a good grasp on this programming stuff. Thanks =) The assignment was to write a program using string functions that accepts a coded value of an item and displays its equivalent tag price. The base of the keys: 0 1 2 3 4 5 6 7 8 9 X C O M P U T E R S Sample I/O Dialogue: Enter coded value: TR.XX Tag Price : 68.00
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
what is meant for variable not found?
what is the large sustained error signal that eventually cause the controller output to drive to its limit