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
djverab [1.8K]
2 years ago
15

Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after th

e shift operation. Does your system place 0s or 1s in the vacated bits?
Computers and Technology
1 answer:
Sindrei [870]2 years ago
4 0

Solution :

#include<$\text{stdio.h}$>

#include<conio.h>

void dec_bin(int number) {

$\text{int x, y}$;

x = y = 0;

for(y = 15; y >= 0; y--) {

x = number / (1 << y);

number = number - x * (1 << y);

printf("%d", x);

}

printf("\n");

}

int main()

{

int k;

printf("Enter No u wanted to right shift by 4 : ");

scanf("%d",&k);

dec_bin(k);

k = k>>4; // right shift here.

dec_bin(k);

getch();

return 0;

}

You might be interested in
you crossed two heterozygous red flowers (dominant color), what are your chances to have a white flower
Lesechka [4]

Answer:

25% chance.

Explanation:

There is 25% chance it'll be h*m*zygous red, 50% chance it'll be h*t*rozygous red, and 25% chance it'll be h*m*zygous wh*te.

(Censored because it wouldn't let me post it for some reason. Honestly hope this doesn't work.)

4 0
2 years ago
What is the output when you run the following program? print(3 + 7) print("2 + 3")
QveST [7]

print(3+7) will output 10, which is an integer.

print("2+3") will output 2+3, which is a string.

6 0
2 years ago
A user has multiple web pages open and is using email. Which layer of the Transmission Control Protocol/Internet Protocol (TCP/I
Ymorist [56]

Answer: Transport layer

Explanation: The Transmission Control Protocol / Internet Protocol both combine to aid aod transmission of data through the internet. While the Transmission control protocol handles the establishment and Maintainace of network connection through applications , the Internet Protocol handles how the established data is being sent. The Transmission Control Protocol is forms a part of the transport layer which aids in the data transmission m ensuring that data is sent to the correct source. The transport layer is able to avoid errors as it ensures that established c is nnectio is maintained until data exchange is complete.

8 0
2 years ago
8.3.7: Exclamat!on Po!nts
Masteriza [31]

The function is an illustration of loops.

Loop instructions are used to repeat operations

The function in Python, where comments are used to explain each line is as follows:

#This defines the function

def exclamation(myStr):

   #This iterates through the string

   for i in range(len(myStr)):

       #This checks if the current character of the string is "i"

       if myStr[i] == "i":

           #If yes, this converts the string to a list

           s = list(myStr)

           #This replaces i with !

           s[i] = '!'

           #This gets the updated string

           myStr = "".join(s)

   #This returns the new string

   return myStr

       

Read more about similar programs at:

brainly.com/question/22444309

5 0
2 years ago
Suggest me horror movies that r genuinely scary
ad-work [718]

Answer:

It depends on your power of resisting fears. everyone have their own tastes.

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with a
    13·1 answer
  • What do you call a named collection of data stored on a disk?
    15·1 answer
  • Where in the Formula tab on the ribbon would you find the Use in Formula function?
    11·2 answers
  • Courses that enable students to begin jobs that require course completion certificates are know as
    8·1 answer
  • Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
    14·1 answer
  • What type of machine is a hand drill?<br><br> A. Simple machine <br> B. Compound machine
    8·2 answers
  • For the following C code assume k and m are passed in x3 and x4 respectively, while result is returned in x4. Compile this code
    14·1 answer
  • quiz Flavio visits a local coffee shop on his way to school and accesses its free Wi-Fi. When he first connects, a screen appear
    7·1 answer
  • PLEASE HELP!!<br> Would you ever try and get famous off of social media? Why or why not?
    6·2 answers
  • I dont know how to put the negative sigh on my computer
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!