Добавить
Уведомления

1.6- scanf() function In C Programming Languages | c language tutorial for beginners | scanf() in c

1.6- scanf() function In C Programming Languages | c language tutorial for beginners | scanf() in c The printf() and scanf() functions are used for input and output in C language. Both functions are inbuilt library functions, defined in stdio.h (header file). printf() function The printf() function is used for output. It prints the given statement to the console. The syntax of printf() function is given below: printf("format string",argument_list); The format string can be %d (integer), %c (character), %s (string), %f (float) etc. scanf() function The scanf() function is used for input. It reads the input data from the console. scanf("format string",argument_list); Program to print cube of given number Let's see a simple example of c language that gets input from the user and prints the cube of the given number. int main(){ int number; printf("enter a number:"); scanf("%d",&number); printf("cube of number is:%d ",number*number*number); return 0; } Output enter a number:5 cube of number is:125 The scanf("%d",&number) statement reads integer number from the console and stores the given value in number variable. The printf("cube of number is:%d ",number*number*number) statement prints the cube of number on the console. Program to print sum of 2 numbers Let's see a simple example of input and output in C language that prints the addition of 2 numbers. int main(){ int x=0,y=0,result=0; printf("enter first number:"); scanf("%d",&x); printf("enter second number:"); scanf("%d",&y); result=x+y; printf("sum of 2 numbers:%d ",result); return 0; } Output enter first number:9 c language ugc net, ugc net c programming, ugc net computer science c programming, gate c programming, gate c programming lecture, Playlist: C Programming Language Practical Tutorials | All University Exam- UGC NET- Gate C Language Tutorials https://www.youtube.com/playlist?list=PLL8qj6F8dGlRAbtKXm-JS0PGHwljufhPv [With Notes] C Programming Language Tutorials- All University Exam- UGC NET- Gate C Language Tutorials https://www.youtube.com/playlist?list=PLL8qj6F8dGlRJ0yYjJGtHrDQjEx56JwK4 #cprogrammingLanguage #cprogramming #cprogrammingLanguageinhindi #cprogrammingLanguage #ugcnetcprogrammingLanguage #gatecprogrammingLanguage #cprogrammingLanguagetutorials #cprogrammingtutorials #cprogrammingLanguagelectures #cprogramminglectures c language in hindi, c programming in hindi, learn c in hindi, c in hindi, c language tutorial for beginners in hindi, c programming for beginners in hindi, c language full course in hindi, learn c programming in hindi, 1.1- What Is C Preprocessor Directives in c language | c programming language tutorials https://youtu.be/_CGGwQ6EDyI 1.2- What Is C Preprocessor Directives in c language | c programming language tutorials https://youtu.be/CojNdPpUPr0 1.3- Execution Phases in C Programming Language | c programming language https://youtu.be/PfGBd6oUWmg 1.4- Escape Sequences In C Language | C Programming Language For Beginners https://youtu.be/gXTFZfDIE4c

Иконка канала Unexplained Mysteries
3 подписчика
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

1.6- scanf() function In C Programming Languages | c language tutorial for beginners | scanf() in c The printf() and scanf() functions are used for input and output in C language. Both functions are inbuilt library functions, defined in stdio.h (header file). printf() function The printf() function is used for output. It prints the given statement to the console. The syntax of printf() function is given below: printf("format string",argument_list); The format string can be %d (integer), %c (character), %s (string), %f (float) etc. scanf() function The scanf() function is used for input. It reads the input data from the console. scanf("format string",argument_list); Program to print cube of given number Let's see a simple example of c language that gets input from the user and prints the cube of the given number. int main(){ int number; printf("enter a number:"); scanf("%d",&number); printf("cube of number is:%d ",number*number*number); return 0; } Output enter a number:5 cube of number is:125 The scanf("%d",&number) statement reads integer number from the console and stores the given value in number variable. The printf("cube of number is:%d ",number*number*number) statement prints the cube of number on the console. Program to print sum of 2 numbers Let's see a simple example of input and output in C language that prints the addition of 2 numbers. int main(){ int x=0,y=0,result=0; printf("enter first number:"); scanf("%d",&x); printf("enter second number:"); scanf("%d",&y); result=x+y; printf("sum of 2 numbers:%d ",result); return 0; } Output enter first number:9 c language ugc net, ugc net c programming, ugc net computer science c programming, gate c programming, gate c programming lecture, Playlist: C Programming Language Practical Tutorials | All University Exam- UGC NET- Gate C Language Tutorials https://www.youtube.com/playlist?list=PLL8qj6F8dGlRAbtKXm-JS0PGHwljufhPv [With Notes] C Programming Language Tutorials- All University Exam- UGC NET- Gate C Language Tutorials https://www.youtube.com/playlist?list=PLL8qj6F8dGlRJ0yYjJGtHrDQjEx56JwK4 #cprogrammingLanguage #cprogramming #cprogrammingLanguageinhindi #cprogrammingLanguage #ugcnetcprogrammingLanguage #gatecprogrammingLanguage #cprogrammingLanguagetutorials #cprogrammingtutorials #cprogrammingLanguagelectures #cprogramminglectures c language in hindi, c programming in hindi, learn c in hindi, c in hindi, c language tutorial for beginners in hindi, c programming for beginners in hindi, c language full course in hindi, learn c programming in hindi, 1.1- What Is C Preprocessor Directives in c language | c programming language tutorials https://youtu.be/_CGGwQ6EDyI 1.2- What Is C Preprocessor Directives in c language | c programming language tutorials https://youtu.be/CojNdPpUPr0 1.3- Execution Phases in C Programming Language | c programming language https://youtu.be/PfGBd6oUWmg 1.4- Escape Sequences In C Language | C Programming Language For Beginners https://youtu.be/gXTFZfDIE4c

, чтобы оставлять комментарии