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
Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with e
docker41 [41]

Answer:

8/9

Explanation:

i remember this question on my daughters book

8 0
3 years ago
Which of the following code displays the area of a circle if the radius is positive? Question 4 options: if (radius &lt;= 0) Sys
Marina CMI [18]

Answer:

(d) if (radius > 0) System.out.println(radius * radius * 3.14159);

Explanation:

Given

Code segment (a) to (d)

Required

Which is correct

Code segment (a): radius <=0

This means that radius is 0 or less, i.e. 0 or negative

Code segment (b): radius !=0

This means that radius is not equal to 0 i.e. it could be positive or negative but definitely not 0

Code segment (c): radius >=0

This means that radius is 0 or greater, i.e. 0 or positive

Code segment (d): radius >0

This means that radius is  greater than 0 i.e. positive

<em>Hence, (d) is correct</em>

3 0
3 years ago
Is a three-prong grounding plug with the third pong broken-off safe to use.
ad-work [718]
What is the answer choices dude
8 0
3 years ago
Assume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the pop
horrorfan [7]

Answer:

//Define class

public class Main {

 //define main method

 public static void main(String[] args)  

 {

   //declare and initialize the double type variable to 128

   double mexico = 128;

   //declare and initialize the double type variable to 323

   double us = 323;

   //declare and initialize the integer type variable to 0  

   int yr = 0;

   //set the while loop to check which is greater

   while (mexico < us)  

   {

     //increment in the variable by 1

     yr++;

     //initialize in the variables acc. to the percentage

     mexico *= 1.0101;

     us *= 0.9985;

   }

   //print the following results

   System.out.println("Population of the Mexico will be exceed the population U.S. in " + yr + " years");

   System.out.println("Population of the Mexico will be " + mexico + " million");

   System.out.println("and population of the U.S. will be " + us + " million");

 }

}

<u>Output</u>:

Population of the Mexico will be exceed the population U.S. in81 years

Population of the Mexico will be 288.88435953355025 million

and population of the U.S. will be 286.0198193927948 million

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, we define the class 'Main' and inside it, we define the main method.
  • Then, declare two double data type variables which are 'mexico' and 'us' and initialize in it to 128 and 323.
  • Declare integer data type variable 'yr' and initialize in it to 0.
  • Set the while loop and pass the condition to check that the variable 'mexico' is less than the variable 'us' then, increment in the variable 'yr' by 1 and multiply the variables 'us' and 'mexico' by the following percentage.
  • Finally, print the following results with the message.
6 0
3 years ago
Information about a computer file, not the actual data that is contained in the file, is called ______
dangina [55]
Bytes, metadata, storage, documents are what come to mind without know the specifics. Sorry, Hope this helps.
5 0
3 years ago
Read 2 more answers
Other questions:
  • Hit and Slopes Program: A Write a program that can be used by a ski resort to keep track if local snow conditions for one week.
    15·1 answer
  • In order to allow communication between vlans for exchange of data what must be used?​
    15·1 answer
  • The picture that graphically represents the items you use in Windows is called a/an
    5·1 answer
  • The incompatibilities in speed between the various devices and the CPU make I/O synchronization difficult, especially if there a
    6·1 answer
  • : Write a function "def countWords(string)" that returns a count of all words in an input string represented by the variable 'st
    14·1 answer
  • 5.2
    8·1 answer
  • File:///media/fuse/drivefs-0142e6928396ed2afff070ead0fbbbcd/root/JerooLessonFourLabA_1.pdf
    6·1 answer
  • Add my sna-p dkarpik58?...
    9·1 answer
  • Who's hype for Halo Infinite?
    11·2 answers
  • Differences between dot_mattix printer and a line printer
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!