Write an assembly language program to find whether a string is palindrome or not?
959126
name "pali"\n\norg 100h\n\njmp start\n\nm1:\ns db 'able was ere ere saw elba'\ns_size = $ - m1\n  db 0Dh,0Ah,'$'\n\nstart:\n\n; first let's print it: \nmov ah, 9\nmov dx, offset s\nint 21h\n\n\nlea di, s\nmov si, di\nadd si, s_size\ndec si  ; point to last char! \n\nmov cx, s_size\ncmp cx, 1\nje is_palindrome  ; single char is always palindrome! \n\nshr cx, 1     ; divide by 2! \n\nnext_char:\n    mov al, [di]\n    mov bl, [si]\n    cmp al, bl\n    jne not_palindrome\n    inc di\n    dec si\nloop next_char\n\n\nis_palindrome:\n   ;  the string is "palindrome!" \n   mov ah, 9\n   mov dx, offset msg1\n   int 21h\njmp stop\n\nnot_palindrome:\n   ;  the string is "not palindrome!" \n   mov ah, 9\n   mov dx, offset msg2\n   int 21h\nstop:\n\n\n; wait for any key press: \nmov ah, 0\nint 16h\n\n\nret\n\n\nmsg1 db "  this is palindrome!$"\nmsg2 db "  this is not a palindrome!$"
324789
racecar, dud, dad, bob, bib, mom, wow, 121, 232, 25852, any combination of numbers that are the same forward or backwards...ask the teacher to figure out how many palindromes are on a digital clock in a 24 hour period...the answer is 114.  other palindromes include  level, civic, was it Eliots toilet i saw, Ana, Anna, maam, SOS, toot, tot, pop, pup, did, ewe, eye, kayak...hope these help!
253461
®\nuse ascii:\n\n\n<p>& # 1 7 4 ;</p>\nwithout the spaces
262986
solos, that would be S-O-L-O-S both backwards and forwards hence it being a palindrome. Hope that was it. :)
748688
go to C:&#92;Program Files and see if it is there
468444
It depends what platform your web application is written in. If it is PHP, there is a library called aspell which has libraries that will check spelling on strings. There is also a java port of aspell.
526248
There are many answers to this:\n\n1) Take the string, make a reverse copy of it and compare the strings\n\n2) Pointer to the start index of the string and end index of the string and start comparing till you get strlen/2\n\n.... for more solutions and code you can search the web
918056
There is probably a better way, or at least a more streamline way, of doing this, but off the top of my head here is what I would do:\n\n1. Create a loop to run through all the characters in your string.\n2. Test each character to see if it falls between ASCII values 47 - 58 (i.e. 0-9). If it does then the character is a number.\n3. If the first test fails then you know that it isn't a number; therefore, you know that it must be a character, so now test to see if it is a character between 'a' and 'd' (i.e. ASCII 97-100).\n\nHere is some sample code (hopefully it can help):\npublic static void main(String[] args){\nString teststr = "d3";\nchar x;\n\nSystem.out.println("Test String:" + teststr);\n\nfor(int i = 0; i < teststr.length(); i++){\nx = teststr.charAt(i);\nif(x >= 47 && x <= 58){\n// Store it however\nSystem.out.println(Integer.parseInt(""+ x));\n}\nelse if(x >= 97 && x <= 100){\nif(x == 'a')\nSystem.out.println("a=" + 1);\nelse if(x == 'b')\nSystem.out.println("b=" + 2);\nelse if(x == 'c')\nSystem.out.println("c=" + 3);\nelse if(x == 'd')\nSystem.out.println("d=" + 4);\n}\n}\n}
397803
/*\n\ni need to know an example of writting a program in c\nlanguage under linux using threads?\n\nwrite aprogram to calculate the result of the equation\nY=3sin(x)+6cos(x)+5x2 so each term accomplished by a\nthread. The main thread will calculate the result.\n\n*/\n\n\n#include <pthread.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n/* static global location -- all threads will read */\nstatic double x;\n\nstatic void*\nthree_sinx(void*p)\n{\n  double* result = (double*)p;\n  *result = 3 * sin(x);\n  return 0;\n}\n\nstatic void*\nsix_cosx(void*p)\n{\n  double* result = (double*)p;\n  *result = 6 * cos(x);\n  return 0;\n}\n\nstatic void*\nfive_x_squared(void*p)\n{\n  double* result = (double*)p;\n  *result = 5 * x * x;\n  return 0;\n}\n\n/*\n *\n * Y = 3sin(x) + 6cos(x) + 5x2\n *\n */\n\nint\nmain(int argc, char* argv[])\n{\n  double result[3]; /* one location for each thread */\n  pthread_t tid[3];\n  void *r;\n  int i;\n\n  /* Set "x" to double value passed in on command line */\n  x = argc>1 ? strtod(argv[1], 0) : 0;\n\n\n  /*\n   *  Since result areas are distinct, no mutex needed\n   */\n  if (pthread_create(&tid[0], NULL,\n    three_sinx, &result[0]) != 0) {\n    perror("pthread_create[0]"), exit(-1);\n  }\n\n  if (pthread_create(&tid[1], NULL,\n    six_cosx, &result[1]) != 0) {\n    perror("pthread_create[1]"), exit(-1);\n  }\n\n  if (pthread_create(&tid[2], NULL,\n    five_x_squared, &result[2]) != 0) {\n    perror("pthread_create[2]"), exit(-1);\n  }\n\n  /* Synchronize on the completing child threads */\n  for (i=0; i<3; i++) {\n    if (pthread_join(tid[i], &r) != 0) {\n      perror("pthread_join");\n      exit(-1);\n    }\n  }\n\n  /* main thread will now combine the result */\n  printf("For y=3sin(x)+6cos(x)+5x2, when x=%f, y=%f&#92;n",\n      x, result[0]+result[1]+result[2]);\n\n  return 0;\n}\n\n\n\nTo show that it works:\n\n$ cc pthr.c -lpthread -lm\n\n$ a.out 3.14159\nFor y=3sin(x)+6cos(x)+5x2, when x=3.141590, y=43.347947\n\n$ a.out 0\nFor y=3sin(x)+6cos(x)+5x2, when x=0.000000, y=6.000000
785470
There are numerous ways to do that. \nHere is, probably the simplest:\n\nchar *s="char *s=%c%s%c;%cmain() {printf(s,34,s,34,10,10);}%c";\nmain() {printf(s,34,s,34,10,10);}\n\nThe program itself is fairly useless.\nThe whole point of an exercise like this is the satisfaction of finding a solution yourself. Too bad, you did not give yourself a chance
195727
Here is one way of doing it, using only what we've seen so far: \n\n#include <stdio.h>\n\nextern int getline(char [], int);\nextern int reverse(char [], int);\n\nint main()\n{\nchar line[100];\nint len;\n\nwhile((len = getline(line, 100)) != EOF)\n{\nreverse(line, len);\nprintf("%s&#92;n", line);\n}\n\nreturn 0;\n}\n\nint reverse(char string[], int len)\n{\nint i;\nchar tmp;\nfor(i = 0; i < len / 2; i = i + 1)\n{\ntmp = string[i];\nstring[i] = string[len - i - 1];\nstring[len - i - 1] = tmp;\n}\nreturn 0;\n}\n\nIn practice, it would be a nuisance to have to pass the length of the string to the reverse function. Strings in C are always terminated by the ``zero'' or ``nul'' character, represented by &#92;0. Therefore, reverse (or any piece of code) can always compute the length of a string, either by searching for the &#92;0, or by calling the library function strlen, which computes the length of a string by searching for the &#92;0. Here is how the program might look if the reverse function did not require that the length of the string be passed in: \n#include <stdio.h>\n#include <string.h>\n\nextern int getline(char [], int);\nextern int reverse(char []);\n\nint main()\n{\nchar line[100];\n\nwhile(getline(line, 100) != EOF)\n{\nreverse(line);\nprintf("%s&#92;n", line);\n}\n\nreturn 0;\n}\n\nint reverse(char string[])\n{\nint len = strlen(string);\nint i;\nchar tmp;\nfor(i = 0; i < len / 2; i = i + 1)\n{\ntmp = string[i];\nstring[i] = string[len - i - 1];\nstring[len - i - 1] = tmp;\n}\nreturn 0;\n}
74860
if you take off the first letter they are all palindromes
1159892
Sequential search:\n\nhttp://cprogramming.com/discussionarticles/sorting_and_searching.html
1088586
1 Machine language\n2 Assembly language\n3 High level Language
624892
u didn't mentioned Language ...this is in C....\n\nint i, j, n;\nprintf("Enter no of lines");\nscanf ("%d",&n);\nfor (i=0;i<n;i++)\n{\n    for(j=0;j<=i;j++)\n    {\n        if(j==0||j==(i+1))\n          printf(" 1");\n        else\n          printf(" %d" ,i+2);\n     }\n     printf("&#92;n");\n}
499645
20+ years ago, I had a homework assignment to do this. However, I had to do it in PL/C. It is possible, but being so long ago, I don't remember exactly how I did it. I remember it started with something like the following:\n\nvoid main()\n{\ncout << "void main()";\ncout << "{";\n// Oops there's a problem here!!!\ncout << "}";\n}\n\nI have a memory of using an array of strings to store the values, rather than list them out individually. I also remember that each token was in two places: as a command in the program and within the string, so when I discovered a mistake, I needed to correct it in two places.\n\nI was taking an automata theory at the time. Our instructor had us do this exercise to demonstrate the principle of proving things about turing machines by having a program execute itself. This technique is used to prove the halting problem.
956311
I'll tell U something that could help in the reverse task\n\nU can use one of two things\n\n1-\nby includeing <string> & < algorithm>\n\nvoid revers(char* a,int length)\n{\n     string s = a;\n     reverse(s.begin() , s.end());\n     a = s;\n}\n\n2- \nby using a loop\n\nvoid reverse(char *a,int length)\n{\n     int i=0;\n     for(i=0;i< = (length/2) ;i++)\n          a[length-i-1] = a[i];\n}