Thursday, 8 November 2012

C Program to Print the abbrevation of an organisation name

By
Write a C program to print the abbreviation of an Organization Name. ( For example
if the input is “BHARAT HEAVY ELECTRONICS LIMITED” , then the output should
be “BHEL”.)


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,j=0,m=0;
char orgname[50],abrevname[10];
clrscr();
printf("|*******************************|\n");
printf("www.flintgroups.com\n");
printf("|*******************************|\n");
printf("Enter The Organisation Name:");
gets(orgname);
for(i=0;i<strlen(orgname);i++)
{
abrevname[m]=orgname[j];
if(orgname[i]==' ')
{
m=m+1;
j=i;
abrevname[m]=orgname[j];
j++;
}
}
abrevname[m+1]='\0';
printf("\nThe Abbrevation is \n");
puts(abrevname);
getch();
}


The Sample output for this program is shown below.

0 comments:

Post a comment

Related Posts Plugin for WordPress, Blogger...

Labels