
II-232 Programming Concepts
8.
#include <stdio.h>
#include <conio.h>
void main()
{
int num=5,result;
clrscr();
result=cb(num);
printf("\n Result of function is=
%.2d",result);
getche();
}
cb(int x)
{
float y;
y=x*x*x;
return(y);
}
OUTPUT:
Result of function is = 125
Find the bug/s in the following program/s.
1.
#include <stdio.h>
#include <conio.h>
void main()
{
int sum( int j, k,l);
clrscr();
sum(1,2,3);
}
sum (int j,int k, int l)
{
printf("%d %d %d",j,k,l);
}
Bug: Function prototype error
M10_ITL-ESL4791_02_SE_C10.indd 232 12/22/2012 5:01:43 PM