transform the equation.

Q) transform the equation.

#include<stdio.h>
#include<string.h>
int main()
{
int t,i,k;
char a[401],c[200];
printf(“Enter the test case:\n”);
scanf("%d",&t);
while(t>0)
{
int n;
printf(“Enter the string:\n”);
scanf("%s",&a[i]);
n = strlen(a);

	for(i=0;i<n;i++)
	{
		if(a[i]=='(')
		continue;

		else if(a[i]>=97 && a[i]<=122)
		{
			printf("c",a[i]);
		}
		
		else if(a[i]=='+' || a[i]=='-' || a[i]=='*' || a[i]=='/' || a[i]=='^')
		{
			
		}

	}


t--;
}

}

–> when i run this code it says that “Segmentation fault (core dumped)”. i dont know y !

you are using

scanf("%s",&a[i]); //Wrong way to input array

Instead use

scanf("%s",a);

Hope it helps :slight_smile:

thanx…i ll try