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]
3 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]3 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
Which of the following is the first step in a lockout-and-tag procedure? A. Place your lock on the breaker or switch. B. Sign yo
yKpoI14uk [10]
The answer is C. Shut off the Electricity to the machine at the breaker m. hope this helps
4 0
4 years ago
Read 2 more answers
What are the tasks of a doc file
geniusboy [140]

Answer:

computer file is a computer resource for recording data discretely in a computer storage device. Just as words can be written to paper, so can information be written to a computer file. Files can be edited and transferred through the internet on that particular computer system.

6 0
4 years ago
An increase in pay because of how well you do a job is called _____.
sleet_krkn [62]
It's either a raise or a promotion.
4 0
3 years ago
Read 2 more answers
Arpenet was the computer created by the military true or false
Sphinxa [80]

True. It was a project that the pentagon was working on in the 60's

3 0
3 years ago
Given that add, a function that expects two integer parameters and returns their sum, and given that two variables, euro_sales a
Evgesh-ka [11]

Answer:

int eurasia_sales = add(euro_sales,asia_sales);

Explanation:

Kindly find the explanation attached

Download txt
7 0
4 years ago
Other questions:
  • A friend knows I'm taking a technology class in college and asks me how a hard drive works. What should I say to a friend about
    10·1 answer
  • Which protocols are TCP/IP application layer protocols? (choose all that apply)
    5·2 answers
  • Where does the Total row of an aggregate function display its results? First row in Datasheet view Only row in Datasheet view La
    10·1 answer
  • What is a statement that adds 1 to the int j when the int counter has a value less than the int n?
    12·1 answer
  • Although you are not a full administrator, you are asked to manage a protected document, allowing customized access to any inter
    7·1 answer
  • Can anyone help me this is due today :) <br> Thank you so much
    14·2 answers
  • Need answer ASAP!!!!
    7·1 answer
  • Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code
    12·1 answer
  • Which of the following is a quality of a mixed economy?
    5·1 answer
  • Before a computer can use a router, what configuration information must it be provided?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!