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


Please Help Members By Posting Answers For Below Questions

What is indirection in c?

610


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

743


What are the advantages and disadvantages of c language?

548


Why c is a mother language?

544


What is cohesion in c?

530






With the help of using classes, write a program to add two numbers.

603


Why main is not a keyword in c?

635


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1614


What is c system32 taskhostw exe?

570


What is difference between function overloading and operator overloading?

643


Without Computer networks, Computers will be half the use. Comment.

1857


What is difference between structure and union in c?

529


Is c compiled or interpreted?

651


What is a shell structure examples?

576


Is null equal to 0 in sql?

633