#include <stdio.h>
int main()
{
int arr[5];//to store 5 numbers
int i=0,counter=0;
printf("enter 5 numbers:\n");
for(i=0;i<5;i++)
scanf("%d",&arr[i]);
//count +ve numbers
for(i=0;i<5;i++)
if(arr[i]>0)
counter=counter+1;
printf("Positive numbers :%d\n",counter);
counter=0;
//count -ve numbers
for(i=0;i<5;i++)
if(arr[i]<0)
counter=counter+1;
printf("Negative numbers :%d\n",counter);
counter=0;
//count 0's
for(i=0;i<5;i++)
if(arr[i]==0)
counter=counter+1;
printf("Zero numbers :%d\n",counter);
return 0;
}
10) Write a program that inputs five numbers and determines the number of negative numbers input,...
This is a Java program Write a program that reads an unspecified number of integers, determines home many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number to 2 decimal places. System.out.println(countPositive); System.out.println(countNegative); System.out.println(total); System.out.printf("%.2f",total * 1.0 / count); Assume inputs are always integer [-912985158, 912985158] and ends with 0. Input 1 2 -1 3...
(Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. If you entire input is 0, display 'No numbers are entered except 0.' *So I think my code is looping because the...
Please write a java program that inputs positive numbers using a while loop until a negative number is input and finds the sum of the numbers input
Java programming 1. Write a program that reads an unspecified number of integers, determines how many positive and negative value have been read, and computes the total and average of the input values (not counting zeros. Your program ends with the input 0. Display the average as a floating point number Here are sample runs: (red indicates a user input) Enter an integer, the input ends if it is 0: 1 2 -1 3 0 The number of positives is...
write a complete little minion program to inputs numbers until a zero is input. the program determines and prints the largest and the sum
using C++ Write a full program (starting from #include) that takes as input the number of seconds after midnight. It then displays the time in hours:minutes:seconds format. Assume the time is displayed in military time, e.g. 06:06:06 or 23:05:57. Note the placement of the zeros for numbers less than 10, which your program should properly display. Your program should show output as in the example below. Enter number of seconds after midnight: 3601
Using basic c++ 2. Count the positive and negative numbers using ***while loop*** • Write a program that reads unspecified number of integers , determines how many negative and positive values have been read. Also calculate total and average. Your program will end with input 0. • Output Enter an integer, the input ends if it is 0: 25 34 -89 72 -35 -67 21 48 0 The number of positives is 5 The number of negatives is 3 The...
Question text Find four problems with this program: ------------------------------------------- using namespace std; // this program inputs three integers, determines if negative, positive, or zero int main() { cout << "Enter an integer" << endl; cin >> input; if (input < 0); cout << "The number is negative." endl; else if (input > 0) cout << "The number is positive" << endl; else cout << "The number is zero" << endl; return 0; } programm c++ please and thank you
Correct the five syntax, run-time or logic errors that are found in the CountAndAverageNumbers.java file. Link to the file: CountAndAverageNumbers.javaPreview the document. Make sure you include comments in your code where errors were corrected. If you do not flag each error with a comment, points will be deducted. Upload the corrected .java file here. The output of the corrected file looks like the following: Debug4Output.PNG This program reads an unspecified number of integers, determines how many positive and negative values...
Topics If/Else statement Description Write a program that determines the larger of the two numbers provided by the user. The program asks the user to enter a number. Then it asks the user to enter another but a different number. Then, it determines the larger of the two numbers and displays it to the user. (If the user happens to enter the two numbers the same, the program may report either of the two numbers as larger.) Requirements Do...