Saturday, 26 December 2020

Write a Program in C++ to find out the Diagonal of a Square taking side of a Square as Input.

 #include<iostream>

#include<cmath>

using namespace std;

main()

    {

        double a,d;

        cout<<"Enter the side of the Square\n";

        cin>>a;

        d=sqrt(2)*a;

        cout<<"Side of the Square= "<<a<<"\n";

        cout<<"Diagonal of the Square= "<<d<<"\n";

    }

No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...