Write Output of Following Piece of Code: Roll No: - 15091519-012

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Write output of following piece of code : Roll No:--------------------15091519-012-------------------------------------------------

void fun(int x, int y) float Circle(int r) int Check(int ch)


{ { {
x=x*x; float a; if(ch>=45)
y =y*y; a=3.14*r*r; return(100);
} return (a); else
main() } return (10*2);
{ main() }
int x=5; { main()
int y=2; float area; {
fun(x,y); int radius=1; int x=45,c;
cout<< x; area=Circle(radius); c=Check(x);
cout<<y; cout<<area<<endl; cout<<c<<endl;
} } }

#include<stdio.h> Write a program to declare and take input in 5 integer array and copy
void A(void); content of this array into another array :
void B(void);
void C(void); #include <iostream>
void Y() {
printf("Y"); using namespace std;
}
void main(void) int main () {
{
printf("Welcome to
Function World\n");
A();
B();
C();
}
void A(void) {
printf("A");
Y();
}
void B(void) {
printf("B");
Y();
}
void C(void) {
printf("C");
Y();
}

Point out the errors in following piece of code and give the reason:

int g(void) int sum(int x,int y) void f(float a); void product(void)
{ { { {
int result; float a; int a,b,c;
cout<<”Inside function” result=x+y; cout<<a; int res;
int h(void) } } cout<<”enter three
{ integers”;
cout<<”Inside cin>>a>>b>>c;
function”; res=a+b+c;
} return res;
} }
Ans:1.Semi colon is Ans:No Value is Ans:Double declaration Ans:It should be int
missing. returned. of a in deifintion of instead of void to return
2.Defining function inside Result should be returned Function.It is already res.Also logically function
a function is illegal. as declared in parameter. name should be sum rather
return result; than product.

You might also like