UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the output of the below: int x, y; printf("%d", scanf("%d %d", &x, &Y));

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

"8 years experienced tutor (C, C++, Mathematics, Computer science)" by passion & "CCNA certified Python developer on Cisco network security platforms" by profession. Good with C, C++, Python, PyATS, Core Java, Networking, Linux, MCSE.

:) Good one. It checks my eye sight. This piece of code would result in an error: "undefined symbol Y". Note: 'scanf( )' not only scans and loads the values entered by users into variables, but it also returns a number which is the count of the number of variables that are successfully scanned by...
read more
:) Good one. It checks my eye sight. This piece of code would result in an error: "undefined symbol Y". Note: 'scanf( )' not only scans and loads the values entered by users into variables, but it also returns a number which is the count of the number of variables that are successfully scanned by itself. So, in this example if the upper case 'Y' in 'scanf( )' is replaced with lower case 'y', the scanf( ) would return 2 on successfully scanning the input values (say 10 and 20) to memory. read less
Comments

Tutor

Answer will no of variable read by scanf that is "2". and please make sure "Y" is not capital, because C is case sensitive language
Comments

Experienced IT Professional with 5 years of experience in Tutoring Programming subjects

scanf is used for reading inputs from the user. So user will be prompted to enter 2 integer numbers. scanf returns the number of successfully read inputs. suppose I entered 15 20 printf is used to prints the value of the variables or value returned by any function. In our case it will print the...
read more
scanf is used for reading inputs from the user. So user will be prompted to enter 2 integer numbers. scanf returns the number of successfully read inputs. suppose I entered 15 20 printf is used to prints the value of the variables or value returned by any function. In our case it will print the output or return value of the scanf function which will be 2. So complete output will be: 15 20 2 read less
Comments

Tutor

Output is 2. why? ans. printf function will count the number of variables that has been scanned because you specify %d which refers to integer.
Comments

Are you looking for an Expert Friendly Tutor?

2
Comments

Tutor

It would not compile at the very first. So, there is no scope to run this program. Conclusion is, it would not print anything on the output window.
Comments

Tutor

It would not compile at very first. So, there is no scope to run this code. Finally, it would not print anything on the output window.
Comments

Python trainer

Hi Pravalika, First thing is you should not ask questions like this (o/p of program etc..), as you can always verify with any compiler you use. You should always ask questions like why such thing..? (Ex. you can ask why the o/p of above program is 5?) Thanks, Janardhan.
Comments

First of all writing such code is not valid but still output concern it is 2, because scanf is library function and it have two parameters
Comments

Trainer

2
Comments

View 48 more Answers

Related Questions

Why we use 'include stdio.h'?
The header file which is added to the program that one has written is basically what 'include stdio.h.' means. Stdio.h is known to contain the input and output operations like "printf" or "scanf" etc....
Jina
How can I avoid the error messages?
When there is a syntax error in the program the compiler indicates it by giving error messages. By following proper syntax we can avoid error messages. Syntax is like grammar rules of english language.
Yusufali
What are security issues in the C language?
Even though the C language is widely used in different systems still it has many security flaws associated with it. This article focuses on discussing security vulnerabilities in the C language. Mainly...
Avinesh
0 0
7
Is a default case necessary in a switch statement?
NO, default is optional and you can omit it if there is no use of it.
My
What is an lvalue?
L-Value stands for left value L-Value of Expressions refer to a memory locations In any assignment statement L-Value of Expression must be a container(i.e. must have ability to hold the data) Variable...
Nagasanthoshi

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Why do pointers have a datatype?
Before we start with pointers you must know what is a variable and a datatype. int a; This is the basic line in every program in 'C' . It means that we are asking the compiler to give us 2 bytes of space...

Everything about printf in C language
What is printf and from where it comes from in C code.? You must have used printf so many times in your Car programs but do you really know everything about printf? Let's see. What is the full form...

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Dynamic Memory Allocation in C using malloc()
#include <stdio.h>#include <conio.h>//#include <malloc.h> OR#include <stdlib.h>void main(){ int *ptr, i, n, sum = 0; printf("how many elements ? "); scanf("%d", &n);...

Some Tricky Questions in C
Can you write two functions in which one executes before main function and other executes after the main function? #pragma startup #pragma exit Where, priority is optional integer value.For user priority...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more