Write a C, C++ program which accepts an input name and print it. This is a basic programming question in which you have to take an input from a user and print it.
C, C++ Programming Interview Questions
Program to add two numbers
Basic programs for practice
Output :
Enter your name : Cprogrammingcode dot com
Your name is Cprogrammingcode dot com
C, C++ Programming Interview Questions
Program to add two numbers
Basic programs for practice
C Program that Accept an Input Name and Print it
#include <stdio.h> int main(void) { char str[100]; printf ("Enter your name \n"); gets(str); printf ("Your name is %s ",str); return 0; }
Output :
Enter your name : Cprogrammingcode dot com
Your name is Cprogrammingcode dot com
C++ Program that Accept an Input Name and Print it
#include <iostream> using namespace std; int main() { char str[100]; cout << "Enter your name \n"; cin.getline(str,100); cout << "Your name is "<<str; return 0; }
C program not working!
ReplyDeleteWhat's the error ?
DeleteWhat is the gets(str) for?
DeleteWhat is the gets(str) for?
DeleteYou can pass space separated string input in a gets(str) method.
Delete