Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Im stuck on this question, Its simple but please help Write a program that reque

ID: 3630955 • Letter: I

Question

Im stuck on this question, Its simple but please help

Write a program that requests the users First name and then users last name. Have it print the entered names on one line and the number of letters in each name on the following line. Align each letter count with the end of the corresponding name, as in the following:

Melissa Honeybee
7 8
Next, have it print the same information, but with the counts aligned with the beginning of each name.
Melissa Honeybee
7 8
I need any random 5-8 names, Thank you

Explanation / Answer

please rate - thanks


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
int main()
{srand(time(0));
int n,i,j,k;
char first[10],last[10];
n=rand()%4+5;
for(i=0;i<n;i++)
   {printf("Enter first name: ");
   gets(first);
    printf("Enter last name: ");
   gets(last);
   printf("%s %s ",first,last);
   j=strlen(first)-1;
   for(k=0;k<j;k++)
       printf(" ");
   printf("%d",strlen(first));
    j=strlen(last);
   for(k=0;k<j;k++)
       printf(" ");
   printf("%d",strlen(last));
   printf(" ");
   printf("%s %s ",first,last);
   printf("%d",strlen(first));
    j=strlen(first);
   for(k=0;k<j;k++)
       printf(" ");
   printf("%d",strlen(last));
   printf(" ");
}
getch();
return 0;
}