hello friends
i start learning c++ and still at basics and was trying to solve a exercise in second chapter. this exercise asked to print a square using asterisks. i am able to create a asterisks solid square and colde is as follows.
i start learning c++ and still at basics and was trying to solve a exercise in second chapter. this exercise asked to print a square using asterisks. i am able to create a asterisks solid square and colde is as follows.
C program to calculate area and perimeter of square and rectangle. To calculate area and perimeter of a square and rectangle in C Programming, you have to ask to the user to enter length and breadth of rectangle and side length of square and make two variable one for area and one for perimeter for each to perform mathematical calculation and display the result. Square root in C can be calculated using sqrt function defined in math.h header file. This function takes a number as an argument and returns the square root of that number. Below I have shared a program to find square root in C.
problem is that i dont need solid square only sides and program should be able to create any size of squrare specified by user. Desired output should look like this
Please can any one give me hint what should i do, i dont need code at the moment i wanna have a go at it first. thanx in advance for any tips.
![How How](/uploads/1/2/5/7/125708819/228642986.png)
- 3 Contributors
- forum 5 Replies
- 792 Views
- 1 Day Discussion Span
- commentLatest Postby RoyalwolfLatest Post
vmanes1,165
Square A Negative Number
Consider testing the current value of col and row, only display the * if row is top or bottom, or if col is left or right edge.
You also should consider getting in the habit of processing in a row oriented fashion. It may not make any difference in this problem, but in future work it will.
Square Root A Number
And, when you work with arrays, the usual loop is
for( i = 0; i < size; i++ )
Another habit you should develop.