473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can you please help me with this C problems?

noylec
5
Hi there... I'm new in C programming and I'm having some problems in creating these 2 program... Can you please help me? ;-)
Here are the given cases:

1. Create a C program using array that will ask the user to input 10 numbers and the numbers will be displayed in reverse...



2. Create a C program using array that will ask the user to input a name and the name will be displayed in reverse. It must also determine if the word is a palindrome or not.

Sample 1:
Enter a Name: madam
The Name in Reverse is: madam
It is a Palindrome.

Sample 2:
Enter a Name: mister
The Name in Reverse is: retsim
It is not a Palindrome.

I hope somebody can help me with this...
Thanks...
Jan 31 '07 #1
1 1354
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. int main()
  5. {
  6.     int i,a[10];
  7.     char str[10],str1[10],*ptr,*ptr1;
  8.     clrscr();
  9.  
  10.     printf("Enter the 10 Numbers : ");
  11.     for(i=0;i<=9;i++)
  12.     {
  13.         scanf("%d",&a[i]);
  14.     }
  15.     printf("The numbers entered are printed in reverse \n");
  16.     for(i=9;i>=0;i--)
  17.     {
  18.         printf("%d  ",a[i]);
  19.     }
  20.     printf("\nEnter the string to check pallindrome or not : ");
  21.     scanf("%s",str);
  22.     for(i=0;i<=9;i++)
  23.     {
  24.         str1[i]=str[i];
  25.     }
  26.     ptr=str;
  27.     ptr1=str1;
  28.     strrev(ptr);
  29.     printf("Reversed string is : %s\n",ptr);
  30.     if(strcmp(ptr,ptr1))
  31.     {
  32.         printf("Not Pallindrome");
  33.     }
  34.     else
  35.     {
  36.         printf("Pallindrome");
  37.     }
  38.     getch();
  39.     return 0;
  40. }
understand and then try to run the code......

understand why i declared two char array and pointers....
check out the strrev () function




Thanks and regards
Rajesh G
rajeshg@infotechsw.com
Jan 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gernot Saborowski | last post by:
To all IIS/ASP-professionals, we just upgraded from one machine to another and are experiencing some strange date time number problems. Both systems have been set up like this: - MS Windows...
4
by: Lloyd Sheen | last post by:
So MS where is the error that is reported on last line, says 1 failed. No indication as to what failed. VS 2003, (reinstalled more times than should have been). ------ Build started: Project:...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a lot of problems with the web site www.ggsurf.com.au I host on www.gnxonline.com and I want to find out if it is my own problem or theirs. I try to use session cookies and it...
13
by: Lloyd Sheen | last post by:
I have now spent 5 hours on google/msdn looking for something useful in the creation of user controls for asp.net. The VS 2003 has very limited support for things such as absolute positioning of...
13
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
7
by: Alan Silver | last post by:
Hello, Furthering my quest to get to grips with CSS, I have been trying a page based on project 4 in "more Eric Meyer on CSS" where he uses three versions of an image to give a translucent...
4
by: dragony2000 | last post by:
I want to solve these questions using C# , Please !!! ************************************************************* 1- The factorial method is used frequently in probability problems. The...
6
by: shapper | last post by:
Hello, I am creating a form that includes a few JQuery scripts and TinyMCE Editor: http://www.27lamps.com/Beta/Form/Form.html I am having a few problems with my CSS: 1. Restyling the Select
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.