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 |
p*=(++q)++*--p when p=q=1 while(q<=6)
How the c program is executed?
what would be the output of the follwing struct st { char name[20]; int i; float f; }; main() { struct st emp = {"forum"}; printf("%d %f",emp.i,emp.f); }
Who invented b language?
declare afunction pointer to int printf(char *)?
what is the difference between malloc() and calloc() function?
What are valid signatures for the Main function?
how to find anagram without using string functions using only loops in c programming
hello friends what do u mean by BUS ERROR i got this error while i am doing my program in DATA STRUCTURES
Write a code to generate divisors of an integer?
Is fortran still used in 2018?
how many errors in c explain deply