Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to find the area of square

Posted By: Helga Miller     Category: C Programming     Views: 8961

Write a program to find the area of square.

Code for Program to find the area of square in C Programming

#include<stdio.h>

void main()
{
    float number1,number2;
    printf("The length is : ");
    if(scanf("%f",&number1)==1)
    {
        number2=number1*number1;
        printf("The area of square is => %f",number2);
    }
    else
    {
        printf("error,enter correct value");
    }
}

====================================OUTPUT======================================

The length is :2.3
The area of square is => 5.290000

The length is :3.378
The area of square is 11.410884
  
Share: 


Didn't find what you were looking for? Find more on Program to find the area of square Or get search suggestion and latest updates.

Helga Miller
Helga Miller author of Program to find the area of square is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!