Headlines
Loading...
C program to read a string and copy the alphabets into another string.

C program to read a string and copy the alphabets into another string.

# include<stdio.h>

# include<conio.h>

void main()

{

 char str[30],str1[30];

 int i= 0,j=0,k=0;

 clrscr();

 printf("Enter the string: ");

 gets(str);

 

 

 while(str[i]!='\0')

 {

  j=str[i];

 

  if ((j>=65 && j<=90) || (j>=97 && j<=122))

  {

   str1[k]=str[i];

   k++;

 

  }

   i++;

 

 }

 for(i=0;i<k;i++)

 {

 printf("%c",str1[i]);

 }

 getch();

}

 

/* Output

Enter the string: Google 45 yahoo 477

Googleyahoo

*/


*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***