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
Grace [21]
3 years ago
6

Write a program that prompts the user to enter a four-digit integer and displays the number in reverse order. Here is a sample r

un:
Enter an integer: 5213

3

1

2

5
Computers and Technology
1 answer:
iVinArrow [24]3 years ago
7 0

Following are the code that is written in c language

#include <stdio.h>

int main() // main function

{

int n1,t; // declaring variable

printf(" Enter an integer :");

scanf("%d",&n1); // taking input

while(n1>0) // iterating over the loop untill the value of n is greater then 0

 {

t=n1%10;

printf("%d",t);

printf("\n");

n1=n1/10;

}

return 0;

}

Explanation:

we taking an integer value n1 and iterating over the loop untill n1>0

suppose n1=1234

then  t=n%10;

means t=1234%10

as % holds reminder means t=4

then print the value of t means print 4

and n1 becomes 123 which is > 0  again condition is checking and same process is follow untill n1>0

output

Enter an integer: 5213

3

1

2

5

You might be interested in
I need someone whos really good with computers to help me with some things
posledela

Okay what do you need to know

4 0
3 years ago
Which type of network attack uses a fake IP address to send data packets from an unauthorized user to a network?
liq [111]
D. DoS. DoS is a way to potentially lag or even crash different types of servers ranging from as small as a simple website to bigger websites and video games servers.
6 0
3 years ago
Read 2 more answers
What is one benefit of Powerpoint Online?
VashaNatasha [74]

Answer:

for edge users

anyone with the url

Explanation:

6 0
2 years ago
Read 2 more answers
class student_record { public: int age; string name; double gpa; }; Implement a void function that has five formal parameters: a
Setler79 [48]

Answer:

void delete_record(student_record *arr, int &size, int age, string name, double gpa) {

int index = -1;

if (arr != NULL && size > 0) {

for (int i = 0; i < size; ++i) {

if (arr[i].age == age && arr[i].name == name && arr[i].gpa == gpa) {

index = i;

break;

}

}

}

if (index != -1) {

for (int i = index; i < size - 1; ++i) {

arr[i] = arr[i + 1];

}

size--;

}

}

8 0
3 years ago
Describe the three functions of all programming languages and list at least two specific examples of each. The examples can be f
natta225 [31]

Answer:

The 3 functions of all programming languages are Input, Execution and collection.

They are described below:

Explanation:

1. <u>INPUT</u>: An input function can be defined as the function in programming that enables or allows the computer take in an input in form of any data type from the user. The input is either stored directly into a variable identifier or processed. A real-life scenario of an input function is taking in food. The intake of any substance into the mouth can be likened to an input function. We take in food into the body through the mouth and this is processed within the body.

Another example of input in a real-life scenario is dumping your trash into the bin. In this case, the bin is taking your trash bag as an input.  An input function in programming can take in integers, strings, character, float, arrays or any kind of data type. An input function allows the user send information to the computer using the keyboard, voice, gestures and other forms of communication.

  • <u>Examples of Input Function using C# programming language</u>

<em>Console.WriteLine("Please type any input from keyboard and press enter:");   </em>

<em>string userName = Console.ReadLine(); </em>

From the above example, In the first line of code, the compiler asks the user to input anything via the keyboard.

In the second line of code, the compiler takes in whatever the user has typed and stores it as a variable that we defined as userinput.<em> </em>

  • <u>Example of Input Function Using Python programming language</u>

<em>print('Type in your name:') </em>

<em>username = input() </em>

The first line of code requests that the user types in his name as an input, then Second line of code takes in the input and stores it as a variable declared as username

2. EXECUTION: execution in programming can be described as the process of performing some kind of operation as instructed by the code. This means that the computer reads through the code and performs any operation that it is asked to perform. such execution operation may include arithmetics, iteration, comparison and as many instructions as written in the code.

A real life scenario of execution is when you press the "play" button of an ipod. The ipod executes the "play" action and plays any song within in.

Another example is pressing 2+2 in your calculator and pressing "=" sign. The calculator performs the 2+2 operation and gives a result.

So we can then say that for every execution there is usually a result.  

  • <u>Examples of Execution Function using C# programming language</u>

<em>class ExecuteExample</em>

<em>  { </em>

<em>    static void Main(string[] args) </em>

<em>    { </em>

<em>      int additionop= 100 + 500; </em>

<em>     } </em>

<em>  }</em>

In the code above, execution occurs at the highlighted line. The compiler is asked to add the numbers 100 and 500. The act/process of adding both numbers is called EXECUTION.

  • <u>Example of Execution Function Using Python programming language</u>

<em>print('Type in your name:') </em>

<em>username = input() </em>

<em>print('We just executed, ' + username )</em>

Continuing from our code in the "input example" . As seen in the code above, execution occurs at the point where the computer prints the output of the user's input. In this case the computer prints "we just executed, + whatever value the user had passed as an input."

3. COLLECTION: Collection in programming is used to describe the process where a computer objects collects and groups  similar elements to form a single unit. This collection can be a group of similar data types.

A real life example of a collection is a Queue of people at an ATM. This can define the Queue collection type. usually this kind of collection is considered as a First in First out collection.

Another example of collection can be a List of cars in a Ford car garage. This garage takes in a range of cars that are Ford models only.

  • <u>Example of Collection Function using C# programming language</u>

List : A List is a type of collection as seen below:

<em>var listcollect = new List<string>(); </em>

<em>listcollect .Add("fordexplorer"); </em>

<em>listcollect .Add("fordedge"); </em>

<em>listcollect .Add("fordescape"); </em>

<em>listcollect .Add("fordtruck"); </em>

<em>foreach (var car in listcollect) </em>

<em>{ </em>

<em>    //do somethin</em>

<em>}</em>

The above code creates a collection(list) of the car names as a string in a tipper garage, adds elements(items) to this list and iterates through the list. This is a typical example of a collection.

  • <u>Example of Collection Function using C# programming language</u>

Queue: a queue is a case of colleciton that uses the first in first out idea. The first in first out concept is : first element to be taken in is pushed out first also known as FIFO:

<em>class ExmapleofQueue</em>

<em> { </em>

<em>  static void Main(string[] args) </em>

<em>  { </em>

<em>   Queue sampleQueue= new Queue(); </em>

<em>   sampleQueue.Enqueue(1); </em>

<em>   sampleQueue.Enqueue(2); </em>

<em>   sampleQueue.Enqueue(3); </em>

<em>   foreach (Object numberel in sampleQueue) </em>

<em>   { </em>

<em>    //do something</em>

<em>   }</em>

<em>}</em>

<em>}</em>

<em>From example above, we can see that we created a queue called sampleQueue. This holds a queue of integers.</em>

<em />

8 0
3 years ago
Read 2 more answers
Other questions:
  • The ability to learn a new computer software program is to ____________ as knowledge of state capitals is to _____________.
    11·1 answer
  • With which network connection type does the vm obtain ip addressing information from its host?
    11·1 answer
  • The syntax for accessing a class (struct) member using the operator -&gt; is ____.
    15·2 answers
  • Which statement about images is correct? A) A virtual image cannot be formed on a screen. B) A virtual image cannot be viewed by
    12·1 answer
  • Is backing up computer files done on the hard drive?
    14·2 answers
  • Can someone tell me what this means Higfaa
    6·1 answer
  • What is a functional organisation? and how it functions​?
    12·1 answer
  • What’s cloud-based LinkedIn automation?
    14·1 answer
  • Which software development method uses highly skilled programmers to shorten the development process while producing quality sof
    9·1 answer
  • The chain of _____ documents that the evidence was under strict control at all times and no unauthorized person was given the op
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!