Advertisement
homer512

print name alt.

Jan 26th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(void)
  5. {
  6.   char first_initial;
  7.   int last_char;
  8.   puts("Enter first and last name");
  9.   first_initial = getchar();
  10.   while(getchar() != ' ');
  11.   while((last_char = getchar()) != EOF && last_char != '\n')
  12.     putchar(last_char);
  13.   printf(", %c\n", first_initial);
  14.   return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement