Looking for answers? Westonci.ca is your go-to Q&A platform, offering quick, trustworthy responses from a community of experts. Experience the convenience of getting reliable answers to your questions from a vast network of knowledgeable experts. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

write a complete program that declares an integer variable

reads a value from the keyboard into that variable, and writes a single line to standard out[ut consisting of the variable's value, twice the value, and the square of the value, separated by single spaces

Besides the number, nothing else should be in the line written to standard output except for the spaces separating the values.


Sagot :

Answer:

Java:

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {

   Scanner sc = new Scanner(System.in);

   int number = sc.nextInt();

   System.out.println(number + " " + number*2 + " " + number**2);

 }

}

Python:

num = int(input("Number: "))

print(num+" "+num*2+" "+num**2)

C++:

#include <iostream>

int main() {

 int number;

 std::cin >> number;

 std::cout << num << " " << num*2 << " " << num**2;

 return 0;

}