D33wakar 36 Posting Whiz in Training

Well, I compiled your code and entered the number 119 and it printed out:
" not a prime
Prime number"
Do you need help or just mocking us?
Can you explain the algorithm you're using for this?(only if you're willing to, there's no pressure)

D33wakar 36 Posting Whiz in Training

I AM USING TURBO C To Write This Programe

I think You should get another compiler, may be pelles C or Code::Blocks or any other, whichever you like and feel comfortable to use.

@gerard4143 sir i am a starter pizz make it correct

If you're a starter ,IMHO you should start with something small.In this code you're just making some general syntax errors like gerard pointed out earlier- using colons instead of semi-colons,or using braces when there is no need of it or using it the wrong way

else
}
par=ptr;
ptr=ptr->left;
}

etc.

WaltP commented: And by getting a 'better compiler' he fails the class. Great idea! :( -4
D33wakar 36 Posting Whiz in Training

Using fgets.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>


int main()
   {
	   FILE *txt_file;
	   const char* substring ="in";/*search word*/
	   int word_match=0,l=strlen(substring);


	   char sentence[25];/*to save the line read from the file)*/


	   if((txt_file=fopen("text.txt","r"))==NULL)
		   {
			   printf("Can't open the file\n");
			   exit(1);
			}

	   while(fgets(sentence,sizeof(sentence),txt_file) )
		   {
			   /*printf("%s\n",sentence);/*testing! testing!*/
			   char* r_string=strstr(sentence,substring);


			   if(r_string!=NULL)
                              {
                                 word_match++;
                              }
                    }


	   fclose(txt_file);
           printf("Matched words:%d\n",word_match);
           return EXIT_SUCCESS;
	}

strstr returns every string that matches the substring.
For example, here I searched for the word 'in' and it returned all the strings containing the characters 'in'.
Though, this may be compulsory in some cases (searching DNA sequences for example),
it is little bit annoying while searching for a "word" in a text.

WaltP commented: Fix your formatting!!!!! -4