Write Output of Following Piece of Code: Roll No: - 15091519-012
Write Output of Following Piece of Code: Roll No: - 15091519-012
Write Output of Following Piece of Code: Roll No: - 15091519-012
#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.