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
stira [4]
3 years ago
5

In C language. Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printe

d line, print the
leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any
other spaces like spaces after the printed number. Ex: userNum = 3 prints:
Computers and Technology
1 answer:
Murrr4er [49]3 years ago
6 0

The program uses loops to print the numbers from 0 to the user input.

It also uses loops to print the indented space before each iteration value.

The program in C where comments are used to explain each line is as follows:

#include <stdio.h>

int main(){

<em>    //This declares userNum as integer</em>

   int userNum;

<em>    //This gets input for userNum from the user</em>

   scanf("%d",&userNum);

<em>    //This iterates through from 0 to userNum</em>

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

<em>    //This iterates from 0 to current iteration value</em>

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

<em>    //This prints the indents</em>

           printf(" ");         }

<em>    //This prints the current iteration value</em>

       printf("%d\n",i);     }

}<em>//The program ends here</em>

<em />

At the end of the program, the program outputs the indent, followed by the iteration value and a new line.

See attachment for the program sample run

Read more about loops at:

brainly.com/question/21751160

You might be interested in
Universal Containers has a requirement to integrate Salesforce with an external system to control record access.
Alenkasestr [34]

Answer:

C.  Use the SOAP API to maintain the related SObject_share records

Explanation:

In order to ensure that Universal Containers have complete control over the system, the company needs to use certain requirements. This is to ensure that non-authorized persons do not have any access to the information. Based on the information provided in the question, the correct option is option C.

3 0
3 years ago
Write two sentences but each one having either computer in it or technology in it. You can use a word more than once in a senten
Ksju [112]

Answer:

Sentences:

1.My computer has a virus

2.Technology may take over the world someday

Explanation:

7 0
2 years ago
Read 2 more answers
Favorite video games list atleast 5<br><br> favorite to least
Aneli [31]

Answer:

Rob lox, Sub nautica, Phasmo phobia, Albion Online,  fnf.

Explanation:

6 0
3 years ago
HELP ASAP!!!! PLEASE !!! What information does the Media Access Control (MAC) on a network card provide?
sladkih [1.3K]

Answer:

3. the company that installed the network card into the computer's motherboard

3 0
3 years ago
Read 2 more answers
write an assembly language procedure that also performs the binary search. The C program will time multiple searches performed b
laiz [17]

Answer:

Let’s identify variables needed for this program.

First variables will be the one which will hold the values present in the Given Numbers in Array list and key of 16-bit and it will be array ARR and KEY. variables will be holding the Messages MSG1 “KEY IS FOUND AT “, RES ”  POSITION”, 13, 10,” $” and MSG2 ‘KEY NOT FOUND!!!.$’ to be printed for the User. Other variables will be holding Length of the Array and it will be LEN, So in all Six variables.

The identified variables are ARR, KEY, LEN, RES, MSG1 and MSG2.

DATA SEGMENT

    ARR DW 0000H,1111H,2222H,3333H,4444H,5555H,6666H,7777H,8888H,9999H

    LEN DW ($-ARR)/2

    KEY EQU 7777H

    MSG1 DB "KEY IS FOUND AT "

    RES DB "  POSITION",13,10," $"

    MSG2 DB 'KEY NOT FOUND!!!.$'

DATA ENDS

CODE SEGMENT  

   ASSUME DS:DATA CS:CODE

START:

     MOV AX,DATA

     MOV DS,AX

   

     MOV BX,00

     MOV DX,LEN

     MOV CX,KEY

AGAIN: CMP BX,DX

      JA FAIL

      MOV AX,BX

      ADD AX,DX

      SHR AX,1

      MOV SI,AX

      ADD SI,SI

      CMP CX,ARR[SI]

      JAE BIG

      DEC AX

      MOV DX,AX

      JMP AGAIN

BIG:   JE SUCCESS

      INC AX

      MOV BX,AX

      JMP AGAIN

SUCCESS: ADD AL,01

        ADD AL,'0'

        MOV RES,AL

        LEA DX,MSG1

        JMP DISP

FAIL: LEA DX,MSG2

DISP: MOV AH,09H

     INT 21H

     

     MOV AH,4CH

     INT 21H      

CODE ENDS

END START

In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra  Segment. Now, from these one is compulsory i.e. Code Segment if at all you don’t need variable(s) for your program.if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.

Explanation:

The attached Logic is a C like Program to conduct a binary search we need small Algorithm Shown above in a very simple way, So Just we will covert the logic into Assembly There are many things uncommon in the programing Language. There are No While Loops or Modules but this things are to be implemented in different ways.

6 0
3 years ago
Other questions:
  • This type of method method performs a task and sends a value back to the code that called it:
    5·1 answer
  • Which one of the following statements is correct? a. Web browsers cannot function without cookies. b. Cookies are text files and
    9·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • What are the useful techniques in program design?
    12·1 answer
  • A sequence of one or more characters is called
    14·1 answer
  • How can I code this in Python with only if-statements? (Only allowed to use the built-in functions int(), float(), and str().)
    8·1 answer
  • The question of ________ arises when considering the way in which online marketers gather consumers’ information over the Intern
    6·1 answer
  • What do u mean by generation of computer
    10·1 answer
  • TRUE OR FALSE: THE BUILDER'S CLUB IS A PAID SUBSCRIPTION.
    9·2 answers
  • Lucas wants to expand his vocabulary to better understand the sentence below. The insidious burglar moved through the house unhe
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!