Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


You have an array of n integers, randomly ordered with value 1
to n-1.The array is such that there is only one and one value
occurred twice. How will you find this number?



You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there..

Answer / balaji ganesh

#include<stdio.h>
void main()
{
int a[100],n,i,j;
clrscr();
scanf("%d",&n,printf("enter size of array:"));
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(a[i]==a[j])
{
printf("second occurence value: %d",a[i]);
break;
}

getch();
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a program that will read the temperature in Celsius and convert that into Fahrenheit.

1 Answers  


Is main is user defined function?

0 Answers  


What is function prototype in c with example?

0 Answers  


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

0 Answers   XYZ,


How is a macro different from a function?

0 Answers   Tech Mahindra,


application of static variables in real time

1 Answers   Bosch,


how to return 1000 variables from functio9n in c?plz give me code also

6 Answers  


int x=5; printf("%d%d%d",x,x<<2,x>>2);

2 Answers   TANCET,


Write any data structure program (stack implementation)

1 Answers   HTC,


a C prog to swap 2 no.s without using variables just an array?

5 Answers   TCS,


How can you restore a redirected standard stream?

0 Answers  


What is a stream water?

0 Answers  


Categories