C example code-welcome program


C Welcome program

This C example program allows the user to input his/her name then the program will show a welcome message. The example output of the program is shown below:

What is your name? John Egg
Welcome John Egg!
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
  char name[20]; printf("What is your name?");
  gets(name);
  printf("Welcome %s!\n",name);
  system("PAUSE");
  return 0;
}

Note: If you use scanf function to get data from keyboard, the text after blank spaces will be ignored. In case that the text to be input is separated by spaces, it is better to use gets function.




Comments

Abhishek yadav comment

 Abhishek yadav

Really i am thankful of it


2017-02-11
tah comment

 tah

asdf


2016-04-16
priyadharshini comment

 priyadharshini

This is very useful..


2016-01-29



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.