51.1k views
2 votes
Working on very first exercise, it asks to make a program that does this...

1. Asks the user to enter his/her last name.
2. Asks the user to enter his/her first name.
3. Prints out the user’s first and last names in that order.

After an hour this is the best I could come up with.

>>> firstname=raw_input('Enter your first name')
Enter your first namePaul
>>> lastname=raw_input('Enter your last name')
Enter your last nameGillett
>>> print firstname+lastname
PaulGillett

I know it isn't right. Someone please give me a hint! ...?

1 Answer

5 votes
The method you have used is correct or you can try it with C

For example:

printf("Enter your first name");
scanf("%c", &firstname);
printf
("Enter your last name");
scanf
("%c", &lastname);

printf
("%c %c", firstname, lastname);

This code would print the first name and the last name of the person who entered his own name.
User Rance
by
7.0k points