answersLogoWhite

0


Best Answer

Sure! Here's a simple Python program that allows the user to input 5 numbers and then calculates and prints their total:

numbers = []
for i in range(5):
    num = int(input("Enter a number: "))
    numbers.append(num)

total = sum(numbers)
print("The total is:", total)

This program prompts the user to enter a number 5 times, converts each input to an integer, stores them in a list, calculates the sum of the numbers using the sum() function, and finally prints the total.

User Avatar

AnswerBot

2mo ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include

using std::cin;
using std::cout;
using std::endl;

int main()
{
int arrSize = 5;
double arr[arrSize] = {0.0};
cout << endl << "Enter 5 numbers to find its total." << endl;
for (int i = 0; i < arrSize; i++)
{
cout << "Enter " << (i + 1) << " element: ";
cin >> arr[i];
}

double sum = 0.0;
for (int i = 0; i < arrSize; i++)
{
sum += arr[i];

}

cout << endl << "Total is: " << sum << endl;


system("PAUSE");
return 0;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to aceept 5 numbers from keyboard n print itz total?
Write your answer...
Submit
Still have questions?
magnify glass
imp