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

IN C LANGUAGE: A) To demonstrate strlen(), input your first name using gets() an

ID: 674103 • Letter: I

Question

IN C LANGUAGE:

A) To demonstrate strlen(), input your first name using gets() and use printf to print the string followed by the number of characters in the string. An input of "Donnovan" would print 8. Show this with 8 string input examples.

B) To demonstrate strcpy(), input your first name using gets(s1) and use strcpy() to copy it to a second string, s2 and print both strings with puts(). So an input of "Donnovan" would print: "string1 = Donnovan string2 = Donnovan".

C) To demonstrate strcat(), use gets() to input your first name, last name, and Red ID as three separate strings, print them out, one per line, concatenate the three strings, and then use puts() to print out Hello followed by your name and Red ID. If the three input strings entered are "Donnovan" "Davis" and "817769055", then it should print:

Explanation / Answer

or

b)

or

c)

#include<stdio.h>
int main(){
  int i=0,j=0;
  char str1[20],str2[20];
puts("Enter first string");
gets(str1);
puts("Enter second string");
gets(str2);
printf("Before concatenation the strings are ");
puts(str1);
puts(str2);
  while(str1[i]!=''){
    i++;
}
  while(str2[j]!=''){
    str1[i++]=str2[j++];
}
str1[i]='';
printf("After concatenation the strings are ");
puts(str1);
return 0;
}