Code:
n=input('Enter the number of points.Only odd numbers are allowed');
Rotangle= 0;% Angle of rotation to rotate the star at
requirement.
centx = 3;%Position of center of the star with respect to
x-axis.
%You can change at your requirement
centy= 7;%Position of center of the star with respect to y-axis
theta = Rotangle + (0 : (n-1)/n*pi : (n-1)*pi);
% angles that the arm tips are located at
amplitude = 3;%distance from the center of star to the arm tip.
%x and y coordinates of the arm tips.
x = amplitude .* cos(theta) + centx;
y = amplitude .* sin(theta) + centy;
plot(x, y, 'r', 'LineWidth', 2);grid on; axis square;
code snippet:
Results:
6) Plot a star that prompts the user to enter how many points the star has....
How do I solve using Matlab?
Plot a star that prompts the user to enter how many points the star has. Only worry about odd numbered points. Indicate to the user only odd numbers can be entered. Change the star line color to red.
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
In C++ Prompts the user to enter 5 numbers. Once the user has entered the 5 numbers, the program should calculate and display the average of the 5 numbers.and The program prompts the user for one number at a time, without using for
In C++ Prompts the user to enter 5 numbers. Once the user has entered the 5 numbers, the program should calculate and display the average of the 5 numbers.and no for(;;) while(1) while(true) do{//code}while(1); without cin The program prompts the user for one number at a time
Write a program which prompts the user to enter a number of rows, and prints a hollow square star pattern with 2 diagonals. Note: you can assume that the integer will always be > 1 and will be an odd number. For example: Input Result 5 Enter number of rows: 5 ***** ** ** * * * ** ** ***** 9 Enter number of rows: 9 ** ** ** * * * * * * * * * * **...
please solve using python
thank you!
Write a program which prompts the user to enter a number of rows, and prints a hollow square star pattern with 2 diagonals. Note: you can assume that the integer will always be > 1 and will be an odd number. For example: Input Result 5 Enter number of rows: 5 ***** ** ** * * * ** ** ***** 9 Enter number of rows: 9 ** ** ** * * * * *...
Write a complete java program that prompts the user for their name and two numbers. The correct java methods and parameters must be passed to find the length of the name entered and return “TRUE” if the sum of numbers is even, or FALSE if the sum of numbers is odd: Notes included in the program Sample Program Please enter a name and I will tell you the length of the name entered John Then length of the name John...
C++
Problem #1 Write a program that prompts user to enter an integer up to 1000 and displays back a message about the number of digits in this number and if number is odd or even. For example, if user enters 93 message back should be "93 has 2 digits and is odd".
(java) Write a While loop that prompts the user for only even numbers. Keep prompting the user to enter even numbers until the user enters an odd number. After the loop ends, print the sum of the numbers. Do not include that last odd number. You should not store the numbers in an array, just keep track of the sum. Make sure to use a break statement in your code. You may assume that a java.util.Scanner object named input has...
Write a program that prompts the user for positive integers, only stopping when a negative integer or zero is given. The program should then print out how many of the positive integers were odd. Example: Enter a positive integer (0 or negative to stop): 9 Enter a positive integer (0 or negative to stop): 4 Enter a positive integer (0 or negative to stop): 7 Enter a positive integer (0 or negative to stop): -3 You entered 2 odd integers....