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

Write a C program email.c that asks the user for a first and last name, and prin

ID: 3925011 • Letter: W

Question

Write a C program email.c that asks the user for a first and last name, and prints out the user’s UCSD email ID consisting of the first letter of the first name followed by at most 7 letters of the last name. The first name is assumed to consist of a single word and everything after the first space are assumed to be part of the last name. When creating the email ID, convert all letters to lower case, and ignore any hyphens and any spaces in the last name. You can assume that the user will always enter at least two words.

Explanation / Answer

#include<stdio.h>

void main(){
char fname[50];
char lname[50];
char result[50];
char c;
char z;
int i;
printf("enter firstname:");
scanf("%s",fname);
printf("enter lastname:");
scanf("%s",lname);
for(i=0;fname[i]!='';i++){
if(i==0 ){
c=fname[i];
if(c>=65 && c<=90)
z=c+32;
else
z=c;
}
}
}
for(i=0;lname[i]'';i++){
if(i<7){
if(c>=65 && c<=90)
result[i]=lname[i]+32;
else
result[i]=lname[i];
}
printf("ucsd email id:%c%s@ucd.edu"z,result);
getch();
return 0;
}
output:
enter firstname:SWARUP
enter lastname:chotoseries
ucsd email id:schotose@ucsd.edu

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote