Hot Topics

Hexaware Solution
Technical Round
#include<stdio.h>
#include<string.h>
#define MAX_CHAR 256
void printFrequency(char *str)
{
int count[MAX_CHAR] = {0};
int i;
int n = strlen(str);
for (i = 0; i < n; i++)
count[str[i]]++;
for (i = 0; i < MAX_CHAR; i++)
if (count[i] != 0)
printf("%c occurs %d times in the given string.\n", i, count[i]);
}
int main()
{
char str[100];
printf("Enter a string: ");
scanf("%s", str);
printFrequency(str);
return 0;
}
/*
OUTPUT -
Enter a string: 56464
4 occurs 2 times in the given string.
5 occurs 1 times in the given string.
6 occurs 2 times in the given string.
*/
#include<stdio.h>
int main()
{
int i, sum = 0;
for (i = 1; i <= 10; i++)
{
sum = sum + i;
printf("%d ",i);
}
printf("\n %d", sum);
}
/*
OUTPUT:
1 2 3 4 5 6 7 8 9 10
55
*/




Popular Category
Hot Topics
Go through our study material. Your Job is awaiting.