#include
using std::cin;
using std::cout;
using std::endl;
double cube(double number);//prototype
int main()
{
double number = 0.0;
cout << endl << "Enter a number: ";
cin >> number;
cout << endl << "Cube of " << number << " is " << cube(number) << endl;
system("PAUSE");
return 0;
}
double cube(double number)
{
return (number * number * number);
}
Also you can use the function pow(x, y) which returns x to the power of y (you have have include math.h).
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
All the smallest factors of a number must be its smallest factor, which for any number is 1, so: loop loop loop print "Enter an integer number: ": input n until num(n) do print "Please enter a number" repeat until n = int(n) do print "Please enter an integer" repeat print "Smallest factor of ":n:" is 1" repeat
Here's a simple Python program that takes two numbers as input and prints each number alongside its square: # Input two numbers num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) # Print each number and its square print(f"Number: {num1}, Square: {num1**2}") print(f"Number: {num2}, Square: {num2**2}") This program uses the input function to read numbers, converts them to floats, and then calculates and displays their squares.
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
write a program to print A to Z on screen in c?
# Ruby code print 'Enter n: '; n = gets.to_i n.times { | i | puts ( i + 1 ) ** 2 if ( i + 1 ) % 3.0 == 0.0 }
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
echo 'print a pattern'
vowels$ = "aeiou" CLS PRINT "PROGRAM: Find if letter is a vowel or not" PRINT INPUT "Type a single alphabet letter: (a-z)/and, then, press Enter key"; aLetter$ PRINT PRINT "Letter "; aLetter$; IF INSTR(vowels$, LCASE$(aLetter$)) THEN PRINT " is a vowel." ELSE PRINT " is NOT a vowel." END
In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT "Enter a number: "; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT "The sum of the digits is "; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.
write a program to print the series 1/12+1/22+.........+1/n2 ?