#include<conio.h>
#include<string.h>
void main()
{
char string[30];
int n;
char c;
char alphabets[20];
int num[20];
char symbol[10];
char operators[10];
int i,j;
int p=0,q=0,r=0,s=0;
clrscr();
printf("Developed By: Nandan Kr. Kushwaha\n\n");
printf("Enter the size of string\n");
scanf("%d",&n);
printf("Enter the string\n");
for(i=0;i<n;i++)
{
c=getchar();
string[i]=c;
}
printf("String is:");
for(i=0;i<n;i++)
{
putchar (string[i]);
}
for(i=0;i<n;i++)
{
c=string[i];
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
{
alphabets[p]=c;
p++;
}
else if(c>='0'&&c<='9')
{
num[q]=c;
q++;
}
else if(c=='+'||c=='-'||c=='*'||c=='/')
{
operators[r]=c;
r++;
}
else
{
symbol[s]=c;
s++;
}}
printf("\n Alphabets are:");
for(j=0;j<p;j++)
{
putchar(alphabets[j]);
}
printf("\n Numbers are:");
for(j=0;j<q;j++)
{
putchar(num[j]);
}
printf("\n Operators are:");
for(j=0;j<r;j++)
{
putchar(operators[j]);
}
printf("\n Symbols are:");
for(j=0;j<s;j++)
{
putchar(symbol[j]);
}
getch();
}
OUTPUT:-
Hello, this is fastidious post I actually loved reading this.
ReplyDeletelearn c++