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 :(



please help me.. how to write a code of this output?? "Enter range number:"10 1 is a..

Answer / 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

More C Interview Questions

Explain spaghetti programming?

0 Answers  


Why can't we initialise member variable of a strucutre

1 Answers  


wap to print "hello world" without using the main function.

22 Answers   TCS, Wipro,


Simplify the program segment if X = B then C &#8592; true else C &#8592; false

0 Answers  


a linear linked list such that the link field of its last node points to the first node instead of containing NULL a) linked list b) circular linked list c) sequential linked list d) none

0 Answers  






explain what is fifo?

0 Answers  


Why isn't it being handled properly?

0 Answers  


program for following output using for loop? 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5

8 Answers   Infosys,


What oops means?

0 Answers  


Can we declare a function inside a function in c?

0 Answers  


What is difference between union and structure in c?

0 Answers  


What are nested functions in c?

0 Answers  


Categories