This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
software_carpentary2 [2011/06/20 03:53] medhamsh |
software_carpentary2 [2011/06/20 03:57] medhamsh |
||
---|---|---|---|
Line 69: | Line 69: | ||
Find the exercises at http://software-carpentry.org/3_0/qa.html | Find the exercises at http://software-carpentry.org/3_0/qa.html | ||
+ | |||
+ | ====== Reading Code ====== | ||
+ | |||
+ | Read the following code and test! | ||
+ | |||
+ | <code> | ||
+ | void main() | ||
+ | { | ||
+ | char str[40]; | ||
+ | int i,flag=0,len; | ||
+ | clrscr(); | ||
+ | printf("\n Enter A string : "); | ||
+ | gets(str); | ||
+ | len=strlen(str); | ||
+ | for(i=0;i<(len/2);i++) | ||
+ | { | ||
+ | if(str[i]!=str[len-1-i]) | ||
+ | { | ||
+ | flag=1; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | if(flag==1) | ||
+ | { | ||
+ | printf(" \n The string is not palindrome"); | ||
+ | } | ||
+ | if(flag==0) | ||
+ | printf("\n String is palindrome"); | ||
+ | getch(); | ||
+ | } | ||
+ | </code> | ||
+ |