Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
879 views
in Functions by (30.3k points)
closed by

Find the error in the following C++ program and rectify it. 

#include<iostream> 

using namespace std; 

int main ()

int x,y,z;

cin>>x>>y;

z = x* y;

cout<<multi(int a, int b)

{

return a*b;

}

1 Answer

+1 vote
by (30.5k points)
selected by
 
Best answer

Error 1: Here function prototype is missing.

Error 2: no need for variable z. 

Error 3: no need of the statement z = x*y;

#include<iostream> 

using namespace std;

int multi(int, int);

int main ()

{

int x,y;

cin>>x>>y;

cout<<multi(x,y);

cout<<multi(int a, int b)

{

return a*b;

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...