From 8e843dc35207c598953d801713d96e3c3f3878a1 Mon Sep 17 00:00:00 2001 From: Siddharth Shrivastav <44272028+damascus8@users.noreply.github.com> Date: Thu, 1 Nov 2018 23:11:07 +0530 Subject: [PATCH] Add program in C to show variable (#20445) --- guide/english/c/variables/index.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/guide/english/c/variables/index.md b/guide/english/c/variables/index.md index d3d8cf9fe6..d1406dbccf 100644 --- a/guide/english/c/variables/index.md +++ b/guide/english/c/variables/index.md @@ -103,3 +103,32 @@ We get `15.300000`. So, say we just want two places after the decimal to give us * Variables are created in the following format: `datatype variable_name = number`. * Format specifiers allow for variables to be printed. * The equals sign `=` allows for values to be assigned to variables. + + + +## Program to show variables + +```C +#include + +int main() { + int i; + float f; + printf ("enter integer value\n"); + scanf ("%d", &i); + printf ("enter float value\n"); + scanf ("%f", &f); + printf ("integer value: %d \nfloat value: %f\n", i, f); + return 0; +} +``` + +#OUTPUT +```sh +enter integer value +1 +enter float value +2.2 +integer value: 1 +float value: 2.200000 +```