Write a C++ program to display the following pattern.AB BC C CD D D D
Question
Write a C++ program to display the following pattern.AB BC C CD D D D
Solution
Sure, here is a simple C++ program that will display the pattern you asked for:
#include <iostream>
int main() {
std::cout << "AB\n";
std::cout << "BC\n";
std::cout << "C\n";
std::cout << "CD\n";
std::cout << "D\n";
std::cout << "D\n";
std::cout << "D\n";
return 0;
}
This program uses the std::cout object, which is an instance of std::ostream and is connected to the standard output stream. The << operator is used to send the string to the output. The \n character is a newline, which starts a new line of output. The return 0; statement signifies that the program has ended successfully.
Similar Questions
22. Display the pattern in c program:* * * * *
Write a C program to represent the following Boolean Expression, Where A, B, C & D are the Binary Inputs.Out = (A.B).(C+D)Print the value of Out for the following values of(a) A = 1; B = 1; C = 0; D = 1;(b) A = 1; B = 0; C = 1; D = 0;(c) A = 1; B = 1; C = 1; D = 1;(d) A = 0; B = 0; C = 1; D = 1;
Evaluate the following expressions and get the value of a, b, c and d by hand.x = 10;y = 20;z = 30;a = x++ + 10;b = --x – x--;c = ++x - ++y - ++z;d = ++y * ++y;Write a C program
Question 27 options: Given the following code in a programming language: y = a / b * (c + d) where a = 9, b = 3, c = 2, d = 1, find the output y.
Read a integer N and print a character pattern with N rows.For example if N=5, the pattern isABBCCCDDDDEEEEE
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.