A string of charaters were given. Find the highest
occurance of a character and display that character.
eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE
OUTPUT: E
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
char str[20];
int max[20],x=1,high;
clrscr();
printf("Enter the string");
scanf("%s",str);//assas[s]iation
n=strlen(str);
for(i=0;i<n;i++)
max[i]=1;
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
if(strcmp(str[i],str[j])==0)
{
max[i]++;
if(max[i]>x)
{
x=max[i];
high=i;
}
}
}
printf("%c is occured %d times",str[high],x);
getch();
}
Is This Answer Correct ? | 21 Yes | 1 No |
what is virtual constroctor ? give an exam for it?-(parimal dhimmar)
What will be the output- for(i=1;i<=3;i++) { printf("%d",i); continue; i++; }
Write a program to enter 10 number of integer entries into an array n and then odds up all the odd entries. the program then displays the result. plssss answer assss fast asss u can...
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
1+1/2!+1/3!+...+1/n!
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
0 Answers Facebook, Webyog, Wipro,
Hello, I am trying to write a program in c++ which accepts month and year from the user and prints the calender. So please tell me the algorithm and what is the calender logic.
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.
#include<iostream.h> //main() //{ class A { friend class B; public: void read(); }; class B { public : int a,b; }; void A::read() { cout<<"welcome"; } main() { A x; B y; y.read(); } In the above program......, as B is a friend of A B can have access to all members,i cant access y.read . could you please tell me the reason and what would i code to execute this program?
write a program to perform generic sort in arrays?
. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of data in columns of the 3x3 (three by three) array variable n[3][3].
write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000