Example:
void world1(); //function declaration
void world2(); //function declaration
char c='*';
int i,j;
void main()
{
char *msg="I KNOWN FUNCTION";
clrscr();
world1(); //function call
printf("%c%22s%7c",c,msg,c);
world2(); //function call
getch();
}
void world1() //function definition
{
int a=-1;
for(i=0;i<15;i++)
{
a++;
for(j=0;j<30;j++)
{
if(j>=(15-a) && j<(15+a))
{
printf(" ");
}
else
{
printf("%c",c);
}
}
printf("\n");
}
}
void world2() //function definition
{
int a=-1;
for(i=0;i<16;i++)
{
a++;
for(j=30;j>0;j--)
{
if(j>a && j<=(30-a))
{
printf(" ");
}
else
{
printf("%c",c);
}
}
printf("\n");
}
}
C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf
No comments:
Post a Comment