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
r-ruslan [8.4K]
3 years ago
10

Write a C program to store each element of an array ad[] of size 8 into a single variable named data. Each element of the array

holds either a 0 or a 1. Element zero of the array should be bit zero of data, element 1 of the array should be bit 1 of data, etc. For example, if the array is:
Computers and Technology
1 answer:
levacccp [35]3 years ago
5 0

Answer:

The program in C is as follows:

#include <stdio.h>

int main(){

   char data[50];

   int ad [8];

int i;

for (i = 0; i < 8; i++) {  scanf("%d", &ad[i]);  }

   int j = 0;    

   for (i = 7; i >= 0; i--) {

       sprintf(&data[j], "%d", ad[i]);

       j++;

   }

printf("%s",data);

   return 0;

}

Explanation:

This declares data as a string

   char data[50];

This declares ad as an integer array

   int ad [8];

This declares i as a counter variable

int i;

This iterates from 0 to 7 to get input for each element of integer array ad

<em> for (i = 0; i < 8; i++) {  scanf("%d", &ad[i]);  }</em>

This declares and initializes j to 0, as a counter variable

   int j = 0;    

This iterates through array ad, backwards and appends each element to variable data

<em>    for (i = 7; i >= 0; i--) {</em>

<em>        sprintf(&data[j], "%d", ad[i]); </em>

<em>        j++;     }</em>

This prints data

printf("%s",data);

You might be interested in
What occurs when a system produces incorrect, inconsistent, or duplicate data?.
kozerog [31]

Answer: Data integrity issues

Explanation:

8 0
3 years ago
Identify way computer are used in television production​
Aleonysh [2.5K]

Answer:

image editing, text om screen, weather graphics, animation, sattelites ... a lot more possibilites are endless just limited

3 0
3 years ago
Hy does a bus network need regular hubs if it is to cover very much ground?
Norma-Jean [14]
A bus network can only accommodate a number connections and a limited area. If there were more hubs connected to the bus network, the coverage of the network would be expanded and the number of connections will also be increased.
7 0
3 years ago
List any three positive impacts of computer technology in our society?
arlik [135]

Answer:

nWhich statement about the origins of the American population is true?

A most Americans descend from people who first populated this continent about 20,000 years ago

b about 98 percent of Americans live in this country due to the waves of Irish and German people who came in mid 1800s

c immigration expander the American population before 1806 ,bur has no significantly contributed to it since then

d the vast majority. of Americans ms either descended from immigrats or are immigrants themselves

Explanation:

sjsikskakakakakkakznxjduwjawjieieiwiwiwiwiwiw idek computer mouse laptopdhsjsjsjsjjsjs

6 0
3 years ago
7. Accepting things that happen without trying to change them is known as
alukav5142 [94]

Answer:

accept people for who they are instead of trying to change them

Explanation:

i don't know if this is right or wrong but i hope this helped you :)

3 0
3 years ago
Other questions:
  • Where does Microsoft word put elements such as text logos or graphics saved for later use in a document
    15·1 answer
  • If someone receives a shock, or a piece of equipment is throwing sparks or arcing you should try to pull them away from the sour
    7·1 answer
  • What is displayed in the alert dialog box after the following code is executed? var items = 3; for (var i = 1; i &lt;= items; i+
    8·1 answer
  • How do you check how much space is left in current drive?
    9·1 answer
  • Open IDLE. Create a new script file (File--&gt;New File, Ctrl n on Windows, Cmd n on macOS). On the first line, place your name
    6·1 answer
  • What software could i use to create music like Aphex Twin?
    6·1 answer
  • C++Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in
    8·1 answer
  • This software application can be used to organize, analyze, and illustrate data?
    12·2 answers
  • Consider legal issues and intellectual property concerns when creating computer programs?
    11·1 answer
  • The border to the right of a column is called the ____.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!