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 (F = (9/5)*C+32). 5. The Fibonacci numbers are 1,1,2,3,5,8,13,21, etc. Use a for loop to list the first 20 Fibonacci numbers 6. Create a triangle using 2 for loops and the "*". 7. Check if a number is prime. 8. Output a list of numbers from 100 to 1 (using a for loop) to a file 9. Use a loop to output all the squares (i.e. 1,4, 9, 16, etc) to a file 10. Take a number such as 47321 and output it backwards to get 12374
//1 program
#include <iostream>
using namespace std;
int main()
{
int i=2,c=0;;
while(i<=10)
{
if(i%2==0)
c++;
i++;
}
cout<<"Total even no. form 2 to 10 :"<<c;
return 0;
}
//2 program
#include <iostream>
using namespace std;
int main()
{
int i=0,c=0;;
while(i<=10)
{
if(i%5==0)
c++;
i++;
}
cout<<"Total multiple of 5 form 0 to 100 :"<<c;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int age,i=0;
do{
if(i>2)
break;
cout<<"Enter the age:" ;
cin>>age;
i++;
}while(age<=0 || age>=100);
}
#include <iostream>
using namespace std;
int main()
{
int c;
float f;
for(c=-20 ;c<=20;c++)
{
f=(9.0/5.0)*c+32;
cout<<f<<endl;
}
}
Using C++ 1. Create a while loop that counts even numbers from 2 to 10 2....
The Fibonacci numbers are 1,1,2,3,5,8,13,21, etc. Use a for loop to list the first 20 Fibonacci numbers Create a triangle using 2 for loops and the "*".
C++ programming language Create a program that 1) counts from 0 to 10, but doeesn't include 10 2) counts backwards from 100 to 50 (inclusive) by 2's
Question 3 Program Language C++ Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence of numbers where each number is represented by the sum of the two preceding numbers, starting with 0 and 1: 0, 1, 1, 2, 3, 5, 8, etc Write a program that repeatedly prompts the user for a positive integer and prints out whether or not that integer is a Fibonacci number. The program terminates when-I is entered. Create a method with the following...
Create a C# program that counts from -3 to 3 in the console using a do . . . while loop. Using a different kind of loop will result in a score of 0 for this problem.
Using python, Write a while loop that counts from 1 to 20 by 4s.
Objectives: Use the while loop in a program Use the do-while loop in a second program Use the for loop in a third program Instructions: Part A. Code a for loop to print the Celsius temperatures for Fahrenheit temperatures 25 to 125. C = 5/9(F – 32).Output should be in a table format: Fahrenheit Celsius 25 ? . . . . . . . . Turn in the source and the output from Part A. Part B. Code a while...
With the use of python IDLE version 3.7.2, use the while loop that iterates 100,000 times. In the loop code, roll a pair of dice by generating(and summing) two random numbers in the range 1 through 6. Report to the user how many data points have been generated (i.e how many times the dice have been rolled), as in: successfully simulated 100,000 dice rolls. Create a histogram of the dice rolls showing how many times a 2 was rolled, how...
Write a program that prints the following console output using the while-loop and for-loop D not use if-else, setw) and ciomanip> for this problem. .Before you open a Word file to copy the screen shots, tell Dr. Jo. Save the Word file as your name in your flash drive. .Take a screen-shot the code and paste to the Word file. (5 points). Take a screen-shots of the console output and paste to the Word file. (5 points) Save the Word...
Labview question: Create a VI using a While Loop that continuously generates random numbers between 0 and 1000 until it generates a number that matches a number selected by the user. Determine how many random numbers the VI generated before the matching number. conditions to applied on above problem: 1. Convert the “random number” generator floating point numerical output to integer values to make it easier to find a match. 2. The “user selected number control” should be on the...
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...