1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
docker41 [41]
3 years ago
8

Write an algorithm that receives a number from the user (you can store the number in a variable called N). Then the algorithm sh

ould separate the digits of the number and print each in a line starting from the number at one’s place, then the number at ten’s place, and so on. Example: if user inputs 329, then the algorithm should produce the following three lines.
9

2

3
Computers and Technology
1 answer:
lbvjy [14]3 years ago
7 0

Answer:

Algorithm:

1. Declare an integer variable N.

2. Read the value N from user.

3.While(N):

 3.1 find r=N%10;

 3.2 print r in new line.

 3.3 Update N as N=N/10.

4.end program.

Implementation in C++.

// header

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int N;

cout<<"Enter an Integer:";

   cin>>N;

// find the digits of number

   while(N)

   {

       // last digit

       int r=N%10;

       // print last digit

       cout<<r<<endl;

       // update the number

       N=N/10;

}

return 0;

}

Output:

Enter an Integer:329                                        

9                                                          

2                                                          

3

You might be interested in
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
2 years ago
How does the zone theory of optical systems resolve the apparent incompatibility of trichromacy and opponency?
lara [203]

Answer:

Money money money

Explanation:

4 0
3 years ago
Ron wants to install an energy efficient and long lasting device for lighting in his new home. Which device should he use?
olga2289 [7]
Ron will most likely want to buy tube lights since that is a good energy saver.
4 0
3 years ago
Read 2 more answers
Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin
Stolb23 [73]

Answer:

#include <iostream>

using namespace std;

class Str{  ///baseclass

   public :

   string super_str;

   string getStr()

   {

       return super_str;

   }

   void setStr(string String)

   {

       super_str=String;

   }

};

class str : public Str{   //inheriting Str publicly

   public :

       string sub_str;

       string getstr()

       {

           return sub_str;

       }

       void setstr(string String)

       {

           sub_str=String;

       }

       bool notstartswith()

       {

           int n=sub_str.length();   //to find length of substr

           bool flag=false;

           for(int i=0;i<n;i++)     //Loop to check beginning of Str

           {

               if(super_str[i]!=sub_str[i])

               {

                   flag=true;

                   break;

               }

           }

           return flag;

       }

};

int main()

{

   str s;    //object of subclass

   s.setStr("Helloworld");  

   s.setstr("Hey");

   if(s.notstartswith()==1)     //checking if str is substring of Str

       cout<<"Str does not start with str";

   else

       cout<<"Str starts with str";

   return 0;

}

OUTPUT :

Str does not start with str

Explanation:

Above program is implemented the way as mentioned. for loop is being used to check the beginning of the str starts with substring or not.

3 0
3 years ago
John wants to add a border to an image he has inserted on a slide. Which of the following groups on the Picture Tools Format tab
weeeeeb [17]

great question I don't know the answer

4 0
2 years ago
Other questions:
  • Which of the following is important to do when downloading a game to your
    8·1 answer
  • Plz answer these questions...those who give answer get the brainliest......hurry up..!!!​
    14·1 answer
  • You have a new phone. What determines what type of messages you can send?
    15·1 answer
  • Please help! would appreciate it very much!
    13·1 answer
  • 1. The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way
    12·1 answer
  • Evie clicks through her presentation slides and realizes they all have transition effects coming from the same location, from th
    13·1 answer
  • HELPPP
    5·1 answer
  • 6
    9·1 answer
  • Many of the first photographers were actually scientists and inventors. True or false?
    7·1 answer
  • Try to crack the code:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!