please help me.. how to write a code of this output??
"Enter range number:"10
1 is an odd number
2 is an even numbers
3 in an odd numbers
4 "
to
10"
"printing all odd numbers:"
1,3,5,7,9
"printing all even numbers:"
2,4,6,8,10
"sum of all odd numbers:25
"sum of all even numbers:30
using a C Programming ARRAY
pleas pleas help.. its my project ..please :(
Answer Posted / mudita rathore
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,sum=0,sum1=0;
printf("enter the all numbers");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
if(a[i]%2==0)
{
printf("even numbers=%d\n",a[i]);
sum=sum+a[i];
printf("sumof even numbers=%d\n",sum);
}
else
{
printf("odd numbers=%d\n",a[i]);
sum1=sum1+a[i];
printf("sum of odd numbers=%d\n",sum1);
}
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Place the #include statement must be written in the program?
int i=10; printf("%d %d %d", i, i=20, i);
What is sizeof array in c?
Why we use conio h in c?
What are the advantages of c language?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What are identifiers in c?
What is the code for 3 questions and answer check in VisualBasic.Net?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
if p is a string contained in a string?
What is fflush() function?
Can you write the algorithm for Queue?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Explain modulus operator.
What is nested structure with example?