Question
c/c++
Last name: First name: ID: Sec: The name, ID and section number that appear at the beginning of the output of the program sho
26 27 8 29 30 #include <stdio.h> #include <stdlib.h> #include <string.h> void main() 1 { char name (51), first (51) = , las
0 0
Add a comment Improve this question Transcribed image text
Answer #1

                       ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:

  

                       ------------------------------------------------------------------------------------------------------

        CODE:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
char name[51], first[51]="", last[51]="";

printf("Enter full name:first name , a space and last name: \n");
scanf("%s %s",&first,&last);

printf("First name: %s\n",first);

printf("Last name: %s",last);

return 0;
}

                       -------------------------------------------------------------------------------------------------------                

                  SNIPPET

main.c 1 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <string.h> 6 7 8 9 int main() 10- { 11 char name[51], first[

                      ---------------------------------------------------------------------------------------------------------

                  OUTPUT

Enter full name:first name r a space and last name : Hue Jackman First name: Hue Last name: Jackman

EXPLANATION:

here , the scanf function is used to scanf the strings named as first and last

so , these varaibles will hold the values entered by the user as first name and last name .

now , in the print statement , we print the values of the first name and last name strings  

                       -------------------------------------------------------------------------------------------------------

I hope this would help you out.

If you like my answer , please upvote

If you have any doubt, you can provide comment /feedback below the answer

Thanks

Add a comment
Know the answer?
Add Answer to:
c/c++ Last name: First name: ID: Sec: The name, ID and section number that appear at...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c/c++ 6 The name, ID and section number that appear at the beginning of the output...

    c/c++ 6 The name, ID and section number that appear at the beginning of the output of the program should be your own, not the ones used in the sample 7 Note: results printed must show the data entered at run time, not the data shown in the sample run below! Sample run: My name: Smith, Peter My ID: 300999999 My section: 001 Enter your last name : Smith Enter your first name: Peter 8 9 10 11 12 13...

  • c/c++ 6 Using some of the library string handling functions Here, you are to read first...

    c/c++ 6 Using some of the library string handling functions Here, you are to read first and last names of a person and join the two into a full nmae. But you will have to check that the string full name has a 'room' for all these characters. In this problem, the maximum number of characters in the full name is 20 Initially allow a maximum number of 15 characters of first & last names (One name length may compensate...

  • c/c++ Passing arrays as arguments to functions. The main() is given, write the function 'average' (Study...

    c/c++ Passing arrays as arguments to functions. The main() is given, write the function 'average' (Study the syntax of passing an array as a function parameter) The program prompts the user to first enter the number of tests given in a course, and then prompts him/her to enter the mark for each test. The marks are stored in an array. This takes place in the main() function. It then passes the array to a function named 'average' that calculates and...

  • I'm having trouble getting my program to output What is your first name? damion what is...

    I'm having trouble getting my program to output What is your first name? damion what is your last name? anderson damion, Your first name is 6 characters Your last name, anderson, is 8 characters Your name in reverse is: noimad nosredna This is my code so far: #include <stdlib.h> #include <stdio.h> void sizeOfName(char** name); void printSizeOfName(int *first, int *last, char** name); void reverseString(int *first, int *last, char** name); int main() {   char** name;   name = (char**)malloc(2*sizeof(char*));   name[0] = (char*)malloc(100*sizeof(char));   name[1]...

  • Given the following program: #include <stdio.h> struct student { int id; char name[20]; char grade; };...

    Given the following program: #include <stdio.h> struct student { int id; char name[20]; char grade; }; void func(struct student stud); int main() { struct student astud; astud.id=9401; strcpy(astud.name, "Joe"); astud.grade = 'A'; func(astud); return 0; } Abdelghani Bellaachia, CSCI 1121 Page: 16 void func(struct student astud) { printf(" Id is: %d \n", astud.id); printf(" Name is: %s \n", astud.name); printf(" Grade is: %c \n", astud.grade); } Modify this program to include the address of a student as a separate structure....

  • c/c++ This is a simple debugging question. The program (as written) tries to add up the...

    c/c++ This is a simple debugging question. The program (as written) tries to add up the elements of two arrays and store the results into a third array. The idea is that every element of the third array equals the sum of the two corresponding (i.e same index or position in the array) elements in the first two arrays. There is a syntax error, because the way it is written is not the correct way to do it. You are...

  • C program help #include #include #include void PrintName(char firstname[16], char lastname[16]); int main () { char...

    C program help #include #include #include void PrintName(char firstname[16], char lastname[16]); int main () { char firstname[16]; char lastname[16]; printf("please enter your first name:"); scanf("%s",firstname); printf("please enter your last name:"); scanf("%s",lastname); PrintName(firstname,lastname); return 0; } void PrintName(char firstname[16], char lastname[16]){ char fullname[34]; *fullname=*firstname+*lastname; (char*) malloc (sizeof (*fullname)); if (strlen(firstname) > 16||strlen(lastname)>16||strlen(fullname)>16) fflush(stdin); else printf(" the full name is %s %s \n",firstname,lastname); printf(" the full name is-> %s",fullname);/*why is one not run*/ return 0; }

  • A)Correct this code and explain what was corrected // C code - For Loop / Array...

    A)Correct this code and explain what was corrected // C code - For Loop / Array Population // This program will populate integers into an array, and then display those integers. // Developer: Johnson, William CMIS102 // Date: Mar 4, 2020 // Global constants #define INTLIMIT 10 #include <stdio.h> // This function will handle printing my name, class/section number, and the date void printStudentData() { char fullName[19] = "William J. Johnson"; char classNumber[9] = "CMIS 102"; char sectionNumber[5] = "4020";...

  • this is c code. please answer all questions on a piece of paper and show work....

    this is c code. please answer all questions on a piece of paper and show work. i need to prepare as i have a midterm i will have to be completing on paper 1) Bit Operators: This C program compiles and runs. What is its output? 1) #include <stdio.h> 2) void main (void) 3) unsigned char x =60; 4) 5) 6) 7) 8 ) 9) 10) 11) 12) 13) unsigned char a = x < 1; unsigned char b unsigned...

  • Name: al Section (ID Number) 400 N/m (first) (last) 20 marks) Calculate the internal actions at point D. Be sure to...

    Name: al Section (ID Number) 400 N/m (first) (last) 20 marks) Calculate the internal actions at point D. Be sure to indicate whether they are positive or negative. 200 N/m 2.5 m3 m 6 m Name: al Section (ID Number) 400 N/m (first) (last) 20 marks) Calculate the internal actions at point D. Be sure to indicate whether they are positive or negative. 200 N/m 2.5 m3 m 6 m

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT