ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
i want to  have a program to read a string and print the 
frequency of each character and it should work in turbo c
 Question Submitted By :: Jagannath
I also faced this Question!!     Rank Answer Posted By  
 
  Re: i want to have a program to read a string and print the frequency of each character and it should work in turbo c
Answer
# 1
#include<stdio.h>
#include <conio.h>
void main()
{
    int a[26],i,l,j;
    char s[180];
    clrscr();
    for(i=0;i<26;i++)
       a[i]=0;
    printf("enter a string: \n");
    gets(s);
    l=strlen(s);
    for(i=0;i<l;i++)
	{
	      for(j=0;j<26;j++)
	      {
		if (s[i] == (j+66) || s[i] == (j + 96) )
			a[j] += 1;
	      }
	}
	printf("charecter | Repetation \n");
	for (j=0;j<26;j++)
	{
	     printf("%c       |   %d   \n ",j+64,a[j]);
	}
    getch();
}
 
Is This Answer Correct ?    5 Yes 4 No
Swarna Sekhar Dhar
 
  Re: i want to have a program to read a string and print the frequency of each character and it should work in turbo c
Answer
# 2
#include<stdio.h>
#include <conio.h>
void main()
{
    int a[26],i,l,j;
    char s[180];
    clrscr();
    for(i=0;i<26;i++)
       a[i]=0;
    printf("enter a string: \n");
    gets(s);
    l=strlen(s);
    for(i=0;i<l;i++)
	{
	      for(j=0;j<26;j++)
	      {
		if (s[i] == (j+65) || s[i] == (j + 97) )
			a[j] += 1;
	      }
	}
	printf("charecter | Repetation \n");
	for (j=0;j<26;j++)
	{
	     printf("%c       |   %d   \n ",j+65,a[j]);
	}
    getch();
}
 
Is This Answer Correct ?    2 Yes 1 No
Rahul
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Can you think of a way when a program crashed before reaching main? If yes how?  2
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
How can I read a directory in a C program? Wipro1
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); } ME3
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer  1
Every time i run a c-code in editor, getting some runtime error and editor is disposing, even after reinstalling the software what may be the problem?  2
Can u return two values using return keyword? If yes, how? If no, why?  7
How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)  4
What is the diffrent between while and do while statement ?  5
write a function which accept two numbers from main() and interchange them using pointers?  3
Find the middle node in the linked list?? (Note:Do not use for loop, count and count/2) Subex2
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro4
what is const volatile?  1
write a program for even numbers?  8
How to add two numbers with using function?  3
find second largest element in array w/o using sorting techniques? use onle one for loop. Zycus-Infotech2
what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means.... TCS1
2.Given the short c program that follows a. make a list of the memory variables in this program b.which lines of code contain operations that change the contents of memory? what are those operations? Void main( void) { Double base; Double height; Double area; Printf(“enter base and height of triangle :”); Scanf(“%lg”, &base); Scanf(“%lg”, &height); Area=base*height/2.0; Printf(“the area of the triangle is %g \n”,area); } Wipro1
How can draw a box in cprogram without using graphics.h header file & using only one printf(); ? NIIT1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com