Welcome to my blog this is test

28 June 2012

write a C program to COPY ONE STRING TO ANOTHER AND COUNT THE NO OF CHARECTERS OCCURED


//Code:
#include
#include
#include
 void main()
  {
   char str1[20],str2[20];
   int i,j,n,temp;
   clrscr();
   printf("\n Enter any string : ");
    scanf("%s",str1);
   for(i=0;str1[i]!='\0';i++)
     str2[i]=str1[i];
     str2[i]='\0';
     printf("\n The  input string is : %s",str1);
     printf("\n The output string is : %s",str2);
     printf("\n The no of charecter is = %d",i);
   getch();
  }

/*Output:
Enter any string : mostumahalat
The  input string is : mostumahalat
The output string is : mostumahalat
The no of charecter is = 12

No comments:

Post a Comment