Write a C program emailc that asks the user for a first and
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.
Solution
#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]!=\'\\0\';i++){
 if(i==0 ){
 c=fname[i];
 if(c>=65 && c<=90)
 z=c+32;
 else
 z=c;
 }
 }
 }
 for(i=0;lname[i]\'\\0\';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

