GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Aztec Systems  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 4 of 8    Print  
A function even_odd_difference()passes the array of elements.Write a program to calculate the difference of the two sums of which one sum adds the elements of odd ones and another adds the elments of even ones.

  
Total Answers and Comments: 1 Last Update: July 23, 2007   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 23, 2007 15:25:21   #1  
shah_saurabh164        

RE: A function even_odd_difference()passes the array o...
/* Saurabh Shah - PUNE*/

#include<stdio.h>
#include<conio.h>

void main()
{
int arr[30] i n sum1 0 sum2 0 sum;
clrscr();
printf("how many numbers u want ? :");
scanf(" d" &n);
printf("nEnter the d numbers...:n" n);
for(i 0;i<n;i++)
scanf(" d" &arr[i]);
for(i 0;i<n;i++)
{
if(i 2 0)
sum1 + arr[i];
else
sum2 + arr[i];
}
printf("n Even sum dn Odd sum d" sum1 sum2);
sum sum1-sum2;
printf("n Difference d" sum);

getch();

}

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : /*Function to insert a node in singly sorted linked list *//*pass the header of the list and the element to be inserted *//*header node i,e head is declared as global *//*node is a structure which contains int info; and a pointer of node    ...

Latest Answer : int main(){int n,i,f1=0,f2=1,f3=0;printf("Enter number of terms : ");scanf("%d",&n);if(n==1)printf("0");if (n==2)printf("0  1");if(n>=3){for(i=3;i

Latest Answer : we cantr find the number of node in circular link list because there is no last node in the cir link list .(if any comment plz mail to me         ) ...

A function even_odd_difference()passes the array of elements.Write a program to calculate the difference of the two sums of which one sum adds the elements of odd ones and another adds the elments of even ones.

Latest Answer : This is the recursive version of the program.#include#includestruct list{        int month;        struct list *next;};typedef struct list node;void init(node* ...

Write a program to print the given integers in the corresponding wordings?Say for eg. if 123 is given as input the output should be displayed as \
Read Answers (1) | Asked by : Anandkumar

For the List class, add a Boolean-valued function that determines whether the data items in the linked list are arranged in ascending order. How can i do this using recursion ?
View Question | Asked by : Rooro

Two numbers are entered through keyboard, write a program to find the value of one number raised to the power another.
Read Answers (3) | Asked by : sweety


 Sponsored Links

 
Related Articles

ERP Systems as Quality Control Support

ERP Systems as Quality Control Support For the past few years ERP systems have became one of the most powerful tools for quality control management But ERP is just an informatics system that provides support to the integrated business management mosgoogle center Goals of the Quality Control Module i
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value&nbsp; and&nbsp; passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

Evolution of database systems

The Evolution of Database systems File Management System Hierarchical database System&nbsp; Network Database System&nbsp; Relational Database System File Management System: The file management system also called as FMS in short is one in which all data is stored on a singl
 

What is DECODE function used for?

DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different character strings or numbers based on value. That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it makes an if then check and matches the value. The general format
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf(&quot;%d&quot;,printf(&quot;%d %d %d&quot;, a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

How does the function call within function get evaluated?

Whenever we have more than one function which is called for a finite number of times then such a function gets evaluated from inside out. Let us understand this concept with an example. For instance consider a function sample called within it 4 times as given in program below: main() { int a=50;
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(&ldquo;%d&rdquo;,x); z= sample() } sample() { printf(&ldquo;Testing program&rdquo;); } Output is &nbsp;&nbsp;&n
 

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.&nbsp;&nbsp; When a programmer wants other than integer values to be returned from function then it is essential that the pro
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape