Duotas natūralaus skaičiaus kvadratas x. Raskite sekantį kvadratą.Input 64 Output 81
Wed Oct 18 2023 20:02:53 GMT+0000 (Coordinated Universal Time)
Saved by
@AdomsNavicki
#include <cmath>
#include <iostream>
int main() {
double square, originalNumber;
// Prompt the user for the square of a natural number
std::cout << "Enter the square of a natural number: ";
std::cin >> square;
// Calculate the original number by taking the square root
originalNumber = sqrt(square);
// Calculate the square of the original number
double resultSquare = (originalNumber + 1) * (originalNumber + 1);
// Display the original number and its square
std::cout << "Original Number: " << originalNumber << std::endl;
std::cout << "Square of Original Number: " << resultSquare << std::endl;
return 0;
}
content_copyCOPY
Comments