Answer:
return instruction used to return a value from a function.
Explanation:
Function is a block of statement which perform the special task.
Syntax for define a function:
type name(parameter_1, parameter_2,...)
{
statement;
return variable;
}
In the syntax, type define the return type of the function. It can be int, float, double and also array as well. Function can return the array as well.
return is the instruction which is used to return the value or can use as a termination of function.
For return the value, we can use variable name which store the value or use direct value.
1000 people died of an alcohol addiction
Answer:
// here is code in C.
// headers
#include <stdio.h>
// main function
int main(void) {
// variable declaration
int favorite_number;
// ask user to enter favorite number
printf("enter your favorite number : ");
// read the number
scanf("%d",&favorite_number);
// print the message
printf("your favorite number is: %d",favorite_number);
return 0;
}
Explanation:
Declare a variable "favorite_number" of integer type.Ask user to enter favorite number and assign it to favorite_number.Then print the message which include the favorite number.
Output:
enter your favorite number : 77
your favorite number is: 77
Answer:
public static int powOfTwo(int input) {
return input*input;
}
You will have to call this method in main
for printing it, write
System.out.println(powOfTwo(your number));
in public static void main(str[]args) {
}