Archives for 

program in c Language

Draw different shape in Java

//Write a program to draw different shape in Java import java.applet.*; import java.awt.*; public class DrawStuff extends Applet { int width, height; public void init() { width = getSize().width; height = getSize().height; setBackground( ); } public void paint( Graphics g ) { g.setColor(; g.drawRect( 30, 40, 150, 20 ); g.setColor( ); g.fillRect( […] Continue reading →

print the pyramid of digits in pattern

//Write a C program to print the pyramid of digits in pattern. #include <stdio.h> main() { int i,s,r,k=0,count,count1; count=0; count1=0; printf(“Enter the number of rows: “); scanf(“%d”,&r); for(i=1;i<=rows;++i)   /*loop for rows*/ { for(s=1;s<=r-i;s++) /* loop for space*/ { printf(” “); count++; } while(k!=2*i-1) { if (count<=r-1) { printf(“%d “,(i+k)); count++; } else { count1++; printf(“%d […] Continue reading →

Use of relational operator

/*Use of relational operator*/ #include<stdio.h> main() { int a,b; clrscr(); printf(“enter values of a”); scanf(“%d”,&a); printf(“enter values of b”); scanf(“%d”,&b); if((a==0)&&(b==0)) { printf(“enter valid values”); goto end; } if(a>b) printf(“a is greater”); else printf(“b is greater”); end:getch(); } Output: Continue reading →

Volume of room

/*Volume of room*/ #include<stdio.h> main() { float l,b,h,volume; clrscr(); printf(“enter the l=”); scanf(“%f”,&l); printf(“enter the b=”); scanf(“%f”,&b); printf(“enter the h=”); scanf(“%f”,&h); volume=l*b*h; printf(“volume=%f”,volume); getch(); } output: Continue reading →