Write a program that asks for your first name, your last name, and then prints the names in the format last, first. - C Operator

C examples for Operator:Arithmetic Operator

Description

Write a program that asks for your first name, your last name, and then prints the names in the format last, first.

Demo Code

#include <stdio.h>

int main(void)
{
  char first_name[20];
  char last_name[20];

  printf("Enter your first and last name (e.g.: John Doe): ");
  scanf("%s %s", first_name, last_name);
  printf("%s, %s\n", last_name, first_name);

  return 0;/*from  w ww . j  a  va  2  s.c  o m*/
}

Result


Related Tutorials