Write a function that takes an odd integer “q” from user and displays UFO shape using X’s and O’s
All UFO’s have 3 lines of X’s.
a is odd and a >=5.
EXAMPLE:
a = 9, displays
XXXXXXXXX
OXXXXXXXO
OOXXXXXOO
EXAMPLE:
a = 5, displays
XXXXX
OXXXO
OOXOO
IN C++
ANSWER:-
Screen shot of program:-


Sample output:-



Copy program:-
#include<iostream>
using namespace std;
int main()
{
int i,a;
cout<<"Enter a(a is odd and a>=5): ";
cin>>a;
if(a%2==1 && a>=5)
{
for(i=0;i<a;i++)
cout<<"X";
cout<<"\nO";
for(i=1;i<a-1;i++)
cout<<"X";
cout<<"O\nOO";
for(i=2;i<a-2;i++)
cout<<"X";
cout<<"OO\n";
}
else
{
cout<<"Error: a must be odd and greater than or equal to 5\n";
}
return 0;
}
Write a function that takes an odd integer “q” from user and displays UFO shape using...
Takes an integer “n” from user and displays the letter L using X’s. EXAMPLE: n = 5 displays, X X X X XXXXX In C++
Write a program that takes a positive integer n as input from the user and displays an n by n checkerboard. (Hint: your main method could do user input then call the constructor for your GUI with n as the argument.) For example, when n = 5, there are 25 alternating white and black squares inside a square boarder. The lower right corner of the overall pattern must be white. Make sure that adjacent squares are different colors regardless of...
Write a program that gets an integer value from the user. Then
it finds and displays its factorial using the following
approximation
Use the function pow(x,n) and exp(x) from math.h
3 f= n! = nn e n
4. Write a program that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using the character 'X'. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following: XXXXX XXXXX XXXXX XXXXX XXXXX c++
by using matlab Write a function that allows the user to insert an integer number, then return if the number is Even or zero or odd number.If the user insert non-integer number the function give error message.
PYTHON: (Sum the digits in an integer using recursion) Write a recursive function that computes the sum of the digits in an integer. Use the following function header: def sumDigits(n): For example, sumDigits(234) returns 9. Write a test program that prompts the user to enter an integer and displays the sum of its digits. Sample Run Enter an integer: 231498 The sum of digits in 231498 is 27
Write a C++ program that 1. Prompt user to enter two integer a and b. 2. Then prints a b rows each of which contains a * b columns of Xs, but after each group of b complete columns the program prints a| symbol (35 pts) An example run of the program follows. a=3, b = 5 XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX| XXXXX|XXXXX|XXXXX|
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".
Write a C function named: div() with one local variable: m to prompt the user to enter one integer for the local variable m. When you call the function, it should display one of the following lines: If m is divisible by 9 the function displays the message m is divisible by 9 If m is divisible by 3 and not divisible 9 (e.g. 24) the function displays the message m is divisible by 3 If m is neither divisible...
PYTHON PROGRAM Write an application that accepts a sentence as input from the user and displays all of the words in the sentence that have an odd number of letters in them