how to write reverse a string program in c? how to write Reverse string program source code using pointers in c programming language..? Armstrong numbers in c? palindrome numbers program in c?
the armstrong number is interesting. to be different, I'd try something like Code: char num[4]; int i, val, sum; for(i=1; i <= 999; ++i) { sprintf(num, "%03d", i); // 000 format sum = pow(num[0] - '0', 3) + pow(num[1] - '0', 3) + pow(num[2] - '0', 3); sscanf(num, "%d", &val); if(val == sum) printf("armstrong: %d\n", i); } the other ones aren't too bad. to reverse the string, use a loop to write out each character from the end to index pos 0. for the pointer thing, try a function and pass the string as an argument, or create a char *ptr to point to your string; if you get the first assignment, this one is the same basic idea using *(ptr + index) instead of str[index]. the palindrome thing is the same value forward as backward... eye and 1221 are palindromes.
Hello Avidwan If you want to get the reverse of any input string using single pointer you can try the following program: You would get the output olleh if the input is Hello.