C program to enter the name of the user and print it on the screen

C program to enter the name of the user and print it on the screen

// Simple program to enter name of user and just print it on the screen

#include <stdio.h>   // header files
#include <stdlib.h>
# include<conio.h>
# include<string.h>

int main()   // main function
{
 char arr[100]; int i,n;  // variable declaration

 printf("\n This is a simple program for array 
implementation in which it takes name as input and print it on the screen\n");

 printf("\n Enter your name length\n"); // print command
 scanf("%d",&n); // taking input

 printf("\n Enter your name\n");
 for(int i = 0;i<=n;i++)   // for loop for repetitive same type of work
 scanf("%c",&arr[i]);   // taking input
 
for(int i = 0;i<=n;i++)   // for loop 
 printf("%c", arr[i]);   // printing array elements

 return 0;   // returning zero to main function
}  // end of main function

RESULT : Output

C program to enter name of user and print it on the screen
C program to enter name of user and print it on the screen

The above code can’t be directly copy-pasted. You must have to type with your own hand. This is made for your better future. 

Are you made for copy paste?

Absolutely “NO”

Then, try hard to understand this code and type with your own.

About the Author: MakeToss

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

error: