Welcome to this blog of mine friends…..

Well… Over these pages i am going to share with you all few fragments of my imaginations, my own writings. I hope you all will enjoy them heartily. Along with it i would be glad to share a few programing stuffs also and all that would seem good to share  :)

 

To begin with i have here a simple C program code that i have written upon the insistence of my friends.  This C program code is basically to print the initials, for instance of names of people……

Note:   for this program i haven’t used structure

 

Code:

#include<stdio.h>
#include<conio.h>
#include<string.h>                               //string.h included because strlen() is used here
void main()
{       int i,j,k,l;
char name[25];
long int code;
clrscr();
printf(“\n**************** 3 EMPLOYEES CODE PROGRAM ********************\n”);
for(k=0;k<3;k++)                                                          //this program will run for three employees
{
printf(“\n Enter Name:\t”);                                     //entering data  for the employee
gets(name);
fflush(stdin);
printf(“\n Enter Employee Code:\t”);
scanf(“%ld”,&code);
l=strlen(name);                                                        //checking string length

for(i=0;i<l;i++)                                                       //checking each individual character of the string
{
if(name[i]==’ ‘ )                                              //if we meet the 1st space
{       printf(“\t %c”,name[0]) ;               //displays 1st string character
printf(“%c”,name[i+1]);                         //the character next to the 1st space is displayed
fflush(stdin);
for(j=(i+1);j<l;j++)                                  //from the space, the next elements checked
{    if(name[j]==’ ‘ )      {                            //on getting the 2nd space
printf(“%c”,name[j+1]);                    //character next to the space is displayed
break;                }
}
break;
}
}
printf(“\n\t %ld”,code);                            //displays the employee code
}
getch();
}

Out put :

 

Hope this program would be of help to you…..  :D