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
True or Flase<br><br> C++ programs are not case-sensitive.
Dimas [21]

Answer:

Flase

Explanation:

They are case sensitive. VBScript is an example of a case insensitive language.

6 0
3 years ago
Read 2 more answers
In the development stages where an application is not yet sufficiently mature enough to be able to be placed into a test environ
Kitty [74]

Answer:

A and C

Explanation:

8 0
3 years ago
Consider two medical tests, A and B for a virus. Test A is 95% effective at recognizing the virus when it is present but has a 1
finlep [7]

Answer:

Test B.

Explanation:

Test A - 95% effective with 10% false positive rate.

Test B -90% effective with 5% false positive rate.

Test A and B are independent methods.

One of the tests is carried out on a person and turns out to be positive.

To calculate the effectiveness of the test,

  Test A = Effectiveness in  percentage divided  by the false positive rate.

                   95/10 = 9.5

 

  Test B  = Effectiveness in  percentage divided  by the false positive rate.

                   90/5 = 18.

   

Test B has a higher effective rate than Test A.

Therefore Test B is more indicative of a positive result than Test A.

8 0
4 years ago
write a program that reads a string from the user containing a date in the form mm/dd/yyyy. it should print the date in the form
julia-pushkina [17]

Using the knowledge in computational language in python it is possible to write a code that reads a string from the user containing a date in the form mm/dd/yyyy.

<h3>Writting the code:</h3>

<em>months_info = ['January', 'February','March','April', 'May','June', 'July','August', 'September', 'October', 'November', 'December']</em>

<em>date = input('Enter a date using the mm/dd/yyyy format ')</em>

<em>m, d, y = date.split('/')</em>

<em>m = int(m) - 1</em>

<em>name_of_month = months_info[m]</em>

<em>print('{} {}, {}'.format(name_of_month, d, y))</em>

See more about python at brainly.com/question/13437928

#SPJ1

3 0
2 years ago
If you want a smartphone with the fewest restrictions on application development what operation system should you use
butalik [34]
Know ur password to turn the restrictions off 

8 0
4 years ago
Other questions:
  • A user launches an application on an Android device. Once the software loads, the user reports that when turning the tablet to w
    14·1 answer
  • What is the full word of"VPN"?​
    15·2 answers
  • What does the merge &amp; center button in the alignment group on the home tab do?
    8·1 answer
  • Built-in user accounts include only the Administrator account created during Windows installation True False
    15·1 answer
  • When societies and governments make decisions, choices have to be made. Which choice is an example of opportunity cost?
    7·1 answer
  • To find out where a particular command is taken from, you can use the _____________ command.
    14·1 answer
  • What is the datapath of add instruction?
    6·1 answer
  • Make a program that receives several integers (the program ends when a negative number is entered) and shows how many times the
    14·1 answer
  • Which option will be used to attach email messages ​
    6·1 answer
  • What is wrong here??
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!