473,788 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can you please help me with this C problems?

noylec
5 New Member
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 1371
rajesh6695
96 New Member
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@infotec hsw.com
Jan 31 '07 #2

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

Similar topics

0
1353
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 2000 Server SP 3 english version - IIS 5 - MS SQL Server 2000 SP 3 english version - Regional options are both set to English US
4
1308
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: SQLEditor, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... Building satellite assemblies...
3
1774
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 doesn't work fine. Eventually I created some test scripts, which can be found in here: www.ggsurf.com.au/info.asp There is a link to Set the Session("TransactionID") = 25 and the page
13
1591
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 the control etc.
13
4337
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 "operation is not allowed when object is open" so I take out the line of code: BookDetails.Connection1.Open and it comes up with the error "operation is not allowed when object
1
9654
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
7
1325
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 effect behind a heading. I have also used some of the ideas in project 2 of the same book where he styles a photo collection. This is mostly working well, but I have a couple of problems. Being a novice at this, I would appreciate some expert advice...
4
2982
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 factorial of a positive integer n (written n! and pronounced “n factorial”) is equal to the product of the positive integers from 1 to n. Write a program that evaluates the factorials of the integers from 1 to 20 with different integer data types....
6
2196
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
10370
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.