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 |
why should i select you?
What are bit fields? What is their use?
What are global variables and how do you declare them?
Write a program that receives as input a number omaadel-n-print, four digits.
Can we use visual studio for c?
Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered
What is sizeof int?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.
When would you use a pointer to a function?
Write a program to check palindrome number in c programming?
Explain the array representation of a binary tree in C.