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?
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 |
write a program that will read the temperature in Celsius and convert that into Fahrenheit.
Is main is user defined function?
What is function prototype in c with example?
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
How is a macro different from a function?
application of static variables in real time
how to return 1000 variables from functio9n in c?plz give me code also
int x=5; printf("%d%d%d",x,x<<2,x>>2);
Write any data structure program (stack implementation)
a C prog to swap 2 no.s without using variables just an array?
How can you restore a redirected standard stream?
What is a stream water?