Code
#include<stdio.h>
#include<string.h>
int main()
{
int i,d,counter=0;
char arr[100];
printf("enter a String \n");
scanf("%[^\n]", arr); //taking multiple input by scanf by skipping the \n
//scanf("%s",arr);
//special character ascii range (32–47 / 58–64 / 91–96 / 123–126)
for(i=0;arr[i]!='\0';i++)
{
d=arr[i];
//printf("%c%d",arr[i],d);
if((d>=32 && d<=47) || (d>=58 && d<=64) || (d>=91 && d<=96) || (d>=123 && d<=126))
{
counter++;
printf("operator found %d time\n",counter);
printf("special character is %c\n",d);
}
}
//printf("%d",i);
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
int i,d,counter=0;
char arr[100];
printf("enter a String \n");
scanf("%[^\n]", arr); //taking multiple input by scanf by skipping the \n
//scanf("%s",arr);
//special character ascii range (32–47 / 58–64 / 91–96 / 123–126)
for(i=0;arr[i]!='\0';i++)
{
d=arr[i];
//printf("%c%d",arr[i],d);
if((d>=32 && d<=47) || (d>=58 && d<=64) || (d>=91 && d<=96) || (d>=123 && d<=126))
{
counter++;
printf("operator found %d time\n",counter);
printf("special character is %c\n",d);
}
}
//printf("%d",i);
return 0;
}
Output
Post Views: 352