use C++ language
Answer 1:
#include <iostream>
using namespace std;
//checks and returns true if given num is prime
bool isPrime(int aI) {
for (int i = 2; i < aI; i++)
if (aI % i == 0)
return false;
return true;
}
int main(){
//iterating from 1-1000
for(int i=1;i<1000;i++){
if(isPrime(i)){
cout<<i<<" ";
}
}
return 0;
}

Answer 2:
#include <iostream>
using namespace std;
int main(){
string str;
cout<<"Choose color: ";
cin>>str;
int i=0;
if(str=="green"){
while(i++<5)
cout<<"green"<<endl;
}
else if(str=="red"){
for( i=0;i<7;i++)
cout<<"red"<<endl;
}
else{
cout<<"Choose better color:";
}
return 0;
}

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Answer 3:
#include <iostream>
#include <stdlib.h>
#include<time.h>
using namespace std;
// Driver program
int main(void)
{
// Use current time as seed for random generator
srand(time(0));
//generating random number between 1-100
cout<<rand()%6+1;
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
use C++ language Output the prime numbers between 1 and 1000 Ask the user for...
use C++ language Create a random number between 1 and 100 Ask the user for their age. Use a while loop to ensure they give you a number between 20 and 50 Give the user five chances to guess the secret password "PASSWORD". If they don't guess it, tell them they do not have access.
C language: P14. Ask a user for three positive integer numbers. Use an input valiadation loop to make sure that all numbers are positive, ask again if not. Determine the smallest, middle and largest number and display them with proper labeling (Smallest=AA, Middle=BB, Largest=CC).
In c# create a program that generates a random number from 1 to 1000. Then, ask the user to guess the random number. If the user's guess is too high, then the program should print "Too High, Try again". If the user's guess is too low, then the program should print "Too low, Try again". Use a loop to allow the user to keep entering guesses until they guess the random number correctly. Once they figure it, congratulate the user....
Rules to follow are:Declare an array with 1000 elements of type intThen in a loop generate 1000 random numbers and assign one to each element in the arrayThe random numbers should be between 1 and 50do not use rand or srand, use code is providedThen, prompt the user to enter a number, store this number in a local variable, the number should be safety checked using the GetInteger() functionThen, iterate through the array and determine how many times the user's...
Guess the number! You will create a program that will ask the user to guess a number between 1 and 10. The pseudocode is below. Be sure to import random at the beginning of your code and use a comment block explaining what your program does #Guess the number week 4 #Name: #Date: #Random number, loop while true #ask user for number. #if number is too high or too low, tell user, if they guessed it break out of loop...
**Using C Language** Get a number from the user and use that number for loops and to make some calculations. Get a number from the user (n) (For example if the user enters a 3, each loop below will repeat 3 times) //ask, get, and return an integer (by reference) void GetIntPointer(int *numPtr); //input: the number entered by the user (pass by copy) //Calculates the product of the first (n)numbers using a while loop and store the result in *productPtr...
Assignment Develop a program to analyze one or more numbers entered by a user. The user may enter one or more numbers for analysis. Input should be limited to numbers from 1 through 1000. Determine if a number is a prime number or not. A prime number is one whose only exact divisors are 1 and the number itself (such as 2, 3, 5, 7, etc.). For non-prime numbers, output a list of all divisors of the number. Format your...
(Java) HELP! Create a program that will ask the user to enter their first name and their favorite number. Ask the user if they would like the information repeated back to them. If they type "Y" display the answers back to them. If they type anything else, display the word "Goodbye". An example of what your output window should look like is below. The system-generated output is in red. The user-provided input is in green. (Your actual program will only...
C++ language Write a program that 1. generates a random integer between 100 and 1000, call the number N 2. reads a file name from the keyboard 3. opens a file for output using the file name from step 2 4. generates N random numbers between 1 and 100 and writes them to the file from step 3 5. closes the file 6. opens the file from steps 3, and 4 for input 7. reads the numbers from the file...
Using C++ 1. Create a while loop that counts even numbers from 2 to 10 2. Create a for loop that counts by five (i.e. 0, 5, 10, ...) from 0 to 100 3. Ask for a person's age and give them three tries to give you a correct age (between 0 and 100) 4. Use a for loop to list Celsius and Fahrenheit temperatures. The "C" should be from -20 to 20 and the F should be shown correspondingly...