Commented code for a win32 console application:
#include //Include stdio.h for console input/output funcs
#include //Include conio.h for getch function (lol)
void main( )
{
int nWidth, nHeight; //Variables to hold width and height of rectangle
while( 1 ) //Infinite loop - can only be exited using "break;" (among others)
{
printf( "Enter rectangle width: " ); //Print text...
scanf( "%d", nWidth ); //Scan for user input
fflush( stdin ); //Flush user input
printf( "Enter rectangle height: " ); //Print text...
scanf( "%d", nHeight ); //Scan for user input
fflush( stdin ); //Flush user input
printf( "Area of rectangle with width of %d and height of %d is %d\n", nWidth, nHeight, nWidth*nHeight ); //Print text...
fflush( stdout ); //Flush output
//Now program will jump back to start of loop
}
}
{Area s the area of cube} {Length is the length of one side of the cube} program AreaofCube; var Area,Length:real; begin write('Enter the length of cube: '); readln(Length); Area:=6*(Length*Length); writeln('The area of cube is ', Area, ' cm^2.'); end.
Reference:cprogramming-bd.com/c_page3.aspx#calculates the value of money
Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.
CLS PRINT "PROGRAM: Calculate both perimeter/area of rectangle" PRINT INPUT " Length"; length INPUT "Breadth"; breadth PRINT PRINT "Perimeter: "; 2 * (length + breadth) PRINT " Area: "; length * breadth END
Write a C program to Draw a RAINBOW and fill the suitable colors ...
The area of rectangle is : 896.0
let x be the width let x+3 be the length The area of a rectangle is length X width Area=(x)(x+3) =x^2+3x
61:71 1:71/61
int length int breadth int area= (length x breadth) print area
Write an equation for the perimeter, and solve it. Remember that the perimeter is the sum of all four sides.
Area of rectangle: 7 times 9 = 63 square unitsArea of rectangle: 9 times 7 = 63 square units
#include<stdio.h> void main() { float length, breadth, area, perimeter; printf("Enter the length & breadth of a Rectangle\n(length breadth): "); scanf("%f %f",&length,&breadth); area=length*breadth; perimeter=2*(length+breadth); printf(" Area of the Rectangle=%0.3f\n",area); printf("Perimeter of the Rectangle=%0.3f\n",perimeter); printf("(Press ENTER to exit.)"); getch(); printf("\n"); }
A = x times (x + 2) A = x squared + 2x
{Area s the area of cube} {Length is the length of one side of the cube} program AreaofCube; var Area,Length:real; begin write('Enter the length of cube: '); readln(Length); Area:=6*(Length*Length); writeln('The area of cube is ', Area, ' cm^2.'); end.
The area of a rectangle with a width of x units and a length of (x + 3) units
6x-14
It's width to length ratio is 3 : 8.