Question

using namespace std ; Write C++ code to do the followings: 1-Display the multiples of 3...

using namespace std ;

Write C++ code to do the followings:

1-Display the multiples of 3 backward from 33 to 3, inclusive.

2-Display the uppercase letters of the alphabet backward from Z to A.

3-Ask the user to enter letters and convert it to uppercase.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
   cout<<"Multiples of 3 backward from 33 to 3, inclusive are:\n";


   for (int i = 33; i >= 3; --i)
   {
       if(i%3==0)
           cout<<i<<endl;
   }
   return 0;
}

===========================================

Output:

akshay@akshay-Inspiron-3537:~$ g++ three.cpp
akshay@akshay-Inspiron-3537:~$ ./a.out
Multiples of 3 backward from 33 to 3, inclusive are:
33
30
27
24
21
18
15
12
9
6
3

============================================================

#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
   cout<<"Uppercase letters of the alphabet backward from Z to A\n";


   for (int i = 90; i >= 65; --i)
   {
      
           cout<<char(i)<<endl;
   }
   return 0;
}

============================================================

akshay@akshay-Inspiron-3537:~$ g++ three.cpp
akshay@akshay-Inspiron-3537:~$ ./a.out
Uppercase letters of the alphabet backward from Z to A
Z
Y
X
W
V
U
T
S
R
Q
P
O
N
M
L
K
J
I
H
G
F
E
D
C
B
A

================================================================

#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
   cout<<"Enter Letter\n";
   char ch;
   cin>>ch;

   if( ch >= 'a' && ch <= 'z')
ch = ch - ('a' - 'A');
cout<<"UpperCase is "<<ch;

  
      
          
  
   return 0;
}

==================================================================

akshay@akshay-Inspiron-3537:~$ g++ three.cpp
akshay@akshay-Inspiron-3537:~$ ./a.out
Enter Letter
a
UpperCase is A

Add a comment
Know the answer?
Add Answer to:
using namespace std ; Write C++ code to do the followings: 1-Display the multiples of 3...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a c++ question note: not using  namespace std; at the beginning of the program Writing...

    This is a c++ question note: not using  namespace std; at the beginning of the program Writing Data to a File This program will write a series of letters, starting with 'A', to an external file (letters.txt). The user will decide how many letters in total get saved to the file. ** IMPORTANT: The test cases will evaluate your code against .txt files that I uploaded. You do NOT have to upload your own txt files. Input: Including 'A', how many...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • This is a c++ question we are not using namespace std at the top Subtraction +...

    This is a c++ question we are not using namespace std at the top Subtraction + Decision and Loop This is a twist on the previous exercise that will help you review loops and decision structures. You will again ask the user to enter two numbers. However, you will ALWAYS subtract the smaller number from the larger number to ensure that you never get a negative number for an answer. You do this by checking the numbers and switching them...

  • Convert the below code into if else selection: #include <iostream> using namespace std; int main() {...

    Convert the below code into if else selection: #include <iostream> using namespace std; int main() { int num; sin. >> num; switch (num) { case 1: cout << "Casel: Value is: << num << endl; break; case 2: break; case 3: cout << "Case3: Value is: " << num << endl; break; default: cout << "Default: Value is: << num << endl; break; } return; }

  • This is a C++ question we do not use namespace std at the beginning of the...

    This is a C++ question we do not use namespace std at the beginning of the program 9. Arrays: Functions and Reading From File Although this code is a little long, the strategy is straightforward and it will really help you practice functions. I have provided a large amount of detail to help you out. In a nutshell, you're going to read some numbers from a file (into an array) and then ask the user for a number that will...

  • Q3). Write a C program to compute and display maximum of three numbers using a function...

    Q3). Write a C program to compute and display maximum of three numbers using a function for maximum of two numbers. Sample Output: Input: 5153 Maximum = 15 Q4). Write a C program to input a lowercase alphabet character then display it as uppercase character. SAMPLE OUTPUT: Enter any a lowercase character: a Uppercase: A

  • Write a code in C language to do following: 1. display pin input by user in...

    Write a code in C language to do following: 1. display pin input by user in **** form instead of numbers by using ncurses 2. verify the pin by comparing with already stored 2 pins in a text file 3. change text color as per user choice WINDOWS BASED

  • Write a code in C language to do following: 1. display pin input by user in...

    Write a code in C language to do following: 1. display pin input by user in **** form instead of numbers by using ncurses 2. verify the pin by comparing with already stored 2 pins in a text file 3. change text color as per user choice WINDOWS BASED

  • I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly...

    I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly program that does the following; 1. count and display the number of words in the user input string. 2. Flip the case of each character from upper to lower or lower to upper. For example if the user types in:   "Hello thEre. How aRe yOu?" Your output should be: The number of words in the input string is: 5 The output string is : hELLO...

  • Please complete Part 1. The code is also below: #include <pthread.h> #include <iostream> using namespace std;...

    Please complete Part 1. The code is also below: #include <pthread.h> #include <iostream> using namespace std; void *PrintHello(void *arg) { int actual_arg = *((int*) arg); cout << "Hello World from thread with arg: " << actual_arg << "!\n"; return 0; } int main() { pthread_t id; int rc; cout << "In main: creating thread \n"; int t = 23; rc = pthread_create(&id, NULL, PrintHello, (void*) &t); if (rc){ cout << "ERROR; return code from pthread_create() is " << rc <<...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT