Q1.What is output of following program?
Source Code->
#include <stdio.h>
#include<conio.h>
void main()
{
clrscr();
for (int i=0;i<5;i++)
{
for (int j=i;j<=8;j++)
printf("*");
printf("\n");
}
getch();
}
Cross-check your answer with this ->
*********
********
*******
******
*****
Q2.What is output of following program?
Source Code->
#include<stdio.h>
#include<conio.h>
void main()
{
int h=9;
float x,y;
clrscr();
x=(float)h*0.7;
y=h*0.7;
printf("Value of x : %f",x);
printf("\nValue of y : %f",y);
printf("\nValue of h : %f",(float)h*0.6);
getch();
}
Cross-check your answer with this ->
Value of x : 6.300000
Value of y : 6.300000
Value of h : 5.400000
Q3.What is output of following program?
Source Code->
#include <stdio.h>
#include<conio.h>
void main()
{
for ( int i=0; i<5; i++)
{
for (int j=4-i; j>0; j--)
printf(" ");
for (j=0; j<=i; j++)
printf("*");
printf("\n");
}
getch();
}
Cross-check your answer with this ->
*
**
***
****
*****
**
***
****
*****
Q4.What is output of following program?
Source Code->
#include <stdio.h>
#include<conio.h>
void main()
{
clrscr();
for ( int i=5; i>0; i--)
{
for (int j=i; j>0; j--)
printf(" ");
for (j=0; j<i; j++)
printf("*");
printf("\n");
}
getch();
}
Cross-check your answer with this ->
*****
****
***
**
*
****
***
**
*
0 comments:
Post a Comment