From 62a9846b61d1a44cbbcfbf1d710b7fb6ac6f7261 Mon Sep 17 00:00:00 2001 From: Christy <56665656+Christy538@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:05:57 +0530 Subject: [PATCH 1/2] Update basic.c --- Basic_C_Examples/basic.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Basic_C_Examples/basic.c b/Basic_C_Examples/basic.c index 21dd84f..1f3f021 100644 --- a/Basic_C_Examples/basic.c +++ b/Basic_C_Examples/basic.c @@ -39,6 +39,19 @@ int main() printf("Integer is %d\n", a); //print integer value printf("Char is %c\n\n", b); //print character value + + + + /*Takes the value entered by the user and displays the output*/ + int i; + char h[20]; + printf("Enter your name: \n"); + scanf("%s",h); //Takes input from the user + printf("Your name is: %s\n",h); + printf("Enter a number: "); + scanf("%d",&i); + printf("Entered number is %d\n",i); + /*Very Important!!! Characters are also integers, look at ASCII table*/ /*Another thing is chars are defined by ' ' not " ", strings are defined as " "*/ @@ -98,4 +111,4 @@ int main() getch(); //Standard function from stdio, wait for return 0; -} \ No newline at end of file +} From 6ddaba38a0fa12b1431185addc1a9f441787945b Mon Sep 17 00:00:00 2001 From: Christy <56665656+Christy538@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:12:29 +0530 Subject: [PATCH 2/2] Update basic.c --- Basic_C_Examples/basic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Basic_C_Examples/basic.c b/Basic_C_Examples/basic.c index 1f3f021..5ad7f62 100644 --- a/Basic_C_Examples/basic.c +++ b/Basic_C_Examples/basic.c @@ -48,7 +48,7 @@ int main() printf("Enter your name: \n"); scanf("%s",h); //Takes input from the user printf("Your name is: %s\n",h); - printf("Enter a number: "); + printf("Enter a number: \n"); scanf("%d",&i); printf("Entered number is %d\n",i); @@ -56,7 +56,7 @@ int main() /*Very Important!!! Characters are also integers, look at ASCII table*/ /*Another thing is chars are defined by ' ' not " ", strings are defined as " "*/ - printf("Char is %c, integer " + printf("\nChar is %c, integer " "value is %d\n\n", b, b); //print char and integer value /*printf can print more variables read the documentation*/