C Program to Print a Integer Entered by a User | ZenTek ZenTek: C Program to Print a Integer Entered by a User
Contact Us:

If You Have Any Problem, Wanna Help, Wanna Write Guest Post, Find Any Error Or Want To Give Us Feedback, Just Feel Free To Contact Us. We Will Reply You Soon.

Name: *


Email: *

Message: *


ZenTek

LiveZilla Live Help

C Program to Print a Integer Entered by a User

Source Code


#include <stdio.h>
int main()
{
    int num;
    printf("Enter a integer: ");  
    scanf("%d",&num);  /* Storing a integer entered by user in variable num */
    printf("You entered: %d",num);
    return 0;
}

Output

Enter a integer: 25
You entered: 25

Explanation

In this program, a variable num is declared of type integer using keyword int. Then, printf() function prints the content inside quotation mark which is "Enter a integer: ". Then, the scanf() takes integer value from user and stores it in variable num. Finally, the value entered by user is displayed in the screen using printf(). Learn more about how printf() and scanf() works in C programming.



Like the Post? Share with your Friends:-

Team SB
Admin: Akash

0 comments:

POST A COMMENT

Contact Us

Name

Email *

Message *

 

About Me

Hello Guys

I am an IT(Information Technology) Student design this blog for your Preference I always enjoyed technical things as a kid

now here i am sharing my knowledge about Tips and Tricks In Internet PC Windows Free Recharges and Other Cool Stuffs Too

So enjoy it

Followers

Widget by : ZenTek
Widget by : ZenTek
Copyright © . ZenTek. All Rights Reserved.
Designed by :-Way2themes