I am running issues with these problems in MATHEMATICA software Coding class. I have previously posted the same material but have been getting answers in c++,Java, etc... I thank the great minds on here but, I am ONLY FOCUSED WITH THE MATHEMATICA program. I wanted to compare my work to confirm my progress. So please only answers in Mathematica language. thank u

a.
#include <iostream>
using namespace std;
int main() {
int i=0,n,sum=0;
while(i<5){
cin>>n;
if(n%3==0){
sum+=n;
}
}
cout<<sum;
}
b.
#include <iostream>
using namespace std;
int main() {
int a[100],i=0,sum=0,product=1;
cout<<"Enter nos.";
cin>>a[i];
i++;
while(a[i-1]!=-1){
cin>>a[i];
i++;
}
char choice;
cout<<"Enter 'a' for addition and 'm' for multiplication:
";
cin>>choice;
i-=2;
if(choice=='a'){
for(int j=0;j<=i;j++){
sum+=a[j];
}
cout<<sum;
}
else if(choice=='m'){
for(int j=0;j<=i;j++){
product*=a[j];
}
cout<<product;
}
}
I am running issues with these problems in MATHEMATICA software Coding class. I have previously posted...
c++ class, coding using code blocker
MinilabLoopLogic The program: You are to write a program called MinilabLoopLogic which does the following Asks the user to enter 2 integers (can be one prompt or two) Gets and stores the ints Explains that the program will generate all integers that are between the numbers and are divisible by a third integer . e Asks the user for the number they should be divisible by Gets and stores that int Since 0 will...
I am writing a code in c for windows. It should be very very basic. The instructions say to use a switch case statement for processing the user input to the menu. Also I prefer the main to be at the top. Should be very basic and simple. a) Print your name. b) Prompt the user to enter a positive number between 1-50, read the entered input, and display all numbers from 0 up to the number entered (the display should...
I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...
I need help with coding with c++. I need to make a lottery program where you enter in 5 numbers from 0-9 and the program will generate 5 random numbers 0-9 to represent the lottery numbers. I'm almost done, but the output isn't exactly what I want. It works fine, but the format should look like this: lottery array: 7 4 9 1 3 user array: 4 2 9 7 p.s. I also need to count how many matching numbers...
So I am having probelms with figuring out how to do this program the part in bold is the part I dont know how to do. This is in JAVA. What I have so far is shown below the question, this is right upto what I have to do next. Choose Your Operation Write a program that uses a WidgetViewer object to do the following: Generate two random integers between 1 and 9 (inclusive). Name one of them x, the...
Am I using the right cin statement to take in values for my array? If I print them out it prints "0x61fea0" with the input 1 2 3 4 5 ///////////////////////////////// #include <iostream> using namespace std; const int ARRAY_LENGTH = 5; int main(){ int numbers[ARRAY_LENGTH]; int threshold; //@todo prompt user to enter array values cout << "Please input 5 numbers: " << endl; for(int i = 0; i < ARRAY_LENGTH; i++){ //@todo add cin statement to read in values for...
I am writing a Java program. My program would ask two questions: (1) 1+1=? (2) 2+1 =? Show one question at a time on the console. The program allows users to input answers via a command-line (no GUI). Give users five seconds to answer each question. The next question would show ONLY when the user answers the question correctly OR when the time is up. Once users answer the question correctly within the given time, the next question needs to...
I am required to use the try - catch block to validate the input as the test data uses a word "Thirty" and not numbers. The program needs to validate that input, throw an exception and then display the error message. If I don't use the try - catch method I end up with program crashing. My issue is that I can't get the try - catch portion to work. Can you please help? I have attached what I have...
Could I get some help with the following Task? The program should be implemented in JavaScript and running on Firefox, a web browser independent to operating systems. The client has specified the following requirements for the functionality of the program: 1. The program should be running without errors throughout two Phases: Information Gathering and Information Presenting. 2. Information Gathering is to gather the information such as state/territory name, the population and population change over previous year for calculation of APG;...
You have been developing a Fraction class for Teacher’s Pet Software that contains several fields and functions. a. Add four arithmetic operators, +, -, *, and /. Remember that to add or subtract two Fractions, you first must convert them to Fractions with a common denominator. You multiply two Fractions by multiplying the numerators and multiplying the denominators. You divide two Fractions by inverting the second Fraction, then multiplying. After any arithmetic operation, be sure the Fraction is in proper...