(1)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(2)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<8;i++)
{
for(j=0;j
{
printf("*");
}
printf("\n");
}
getch();
}
(3)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<8;i++)
{
for(j=0;j<=2*i-3;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(4)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<6;i++)
{
for(j=0;j<=2*i-2;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(5)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<5;i++)
{
for(j=0;j<3*i-2;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(6)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<6;i++)
{
for(j=0;j<6-i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(7)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<6;i++)
{
for(j=0;j<8-2*i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(8)What will be output when you compile and execute the following code?
void main()
{
int i,j;
clrscr();
for(i=0;i<6;i++)
{
for(j=0;j<=8-2*i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(9)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
clrscr();
for(i=0;i<4;i++)
{
for(j=0;j<2*pow(2,i);j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(10)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
clrscr();
for(i=0;i<4;i++)
{
for(j=0;j
{
printf("*");
}
printf("\n");
}
getch();
}
(11)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
clrscr();
for(i=0;i<4;i++)
{
for(j=0;j
{
printf("*");
}
printf("\n");
}
getch();
}
(12)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
clrscr();
for(i=0;i<3;i++)
{
for(j=0;j<3*pow(3,i);j++)
{
printf("*");
}
printf("\n");
}
getch();
}
(13)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
char c='*';
clrscr();
for(i=0;i<5;i++)
{
for(j=0;j
{
printf("%*c",2,c);
}
printf("\n");
}
getch();
}
(14)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
char * c="*******";
clrscr();
for(i=0;i<5;i++)
{
printf("%*.*s\n",i,i,c);
}
getch();
}
(15)What will be output when you compile and execute the following code?
#include"math.h"
void main()
{
int i,j;
char * c="*******";
clrscr();
for(i=0;i<5;i++)
{
printf("%*.*s\n",i+6,i,c);
}
getch();
}
(16)What will be output when you compile and execute the following code?
void main(){
char *ptr="*******";
int i,j;
clrscr();
for(i=0;i<8;i++){
printf("%*.*s\n",8,i,ptr);
}
getch();
}
(17)What will be output when you compile and execute the following code?
void main(){
char *ptr="*********";
int i,j;
clrscr();
for(i=0;i<5;i++){
printf("%*.*s\n",5+i,2*i+1,ptr);
}
getch();
}
(18)What will be output when you compile and execute the following code?
void main(){
char *ptr="*********";
int i,j;
clrscr();
for(i=0;i<10;i++){
if(i<5)
printf("%*.*s\n",5+i,2*i+1,ptr);
else
printf("%*.*s\n",14-i,19-2*i,ptr);
}
getch();
}
(19)What will be output when you compile and execute the following code?
void main(){
char *ptr="*********";
int i,j;
clrscr();
for(i=0;i<9;i++){
if(i<5)
printf("%*.*s\n",5+i,2*i+1,ptr);
else
printf("%*.*s\n",13-i,17-2*i,ptr);
}
getch();
}
(20)What will be output when you compile and execute the following code?
void main(){
char *ptr="*********";
int i,j;
clrscr();
for(i=0;i<5;i++){
printf("%*.*s\n",9-i,9-2*i,ptr);
}
getch();
}
(21)What will be output when you compile and execute the following code?
void main(){
char *ptr="*****";
int i,j;
clrscr();
for(i=0;i<10;i++){
if(i<6)
printf("%*.*s\n",5,i,ptr);
else
printf("%*.*s\n",5,10-i,ptr);
}
getch();
}
(22)What will be output when you compile and execute the following code?
void main(){
char *ptr="*****";
int i,j;
clrscr();
for(i=1;i<10;i++){
if(i<6)
printf("%*.*s\n",0,i,ptr);
else
printf("%*.*s\n",0,10-i,ptr);
}
getch();
}
(23)What will be output when you compile and execute the following code?
void main(){
char *ptr="*********";
int i,j;
clrscr();
for(i=0;i<11;i++){
if(i<5)
printf("%*.*s\n",5+i,2*i+1,ptr);
else
{
if(i==7)
{
*(ptr+3)=' ';
*(ptr+4)=' ';
*(ptr+5)=' ';
}
printf("%*.*s\n",9,9,ptr);
}
}
getch();
}
3 comments:
printf("%*.*s\n",5+i,2*i+1,ptr);
wat is the lodic in the printf.. kindly explain..
Hi Baby
Go through the following link :
http://cquestionbank.blogspot.com/2009/01/what-is-prototype-of-printf-function.html
I think it will help you.
Q.2 ) for(j=0;j
{
Condition is missing .Please fill it
Post a Comment