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
Mkey [24]
4 years ago
3

write a program that takes in a positive integer as input, and output a string of 1's and 0's representing the integer in binary

. for an integer x; the algothm is as long as x is greater than 0 output x % (remainder is either 0 or 1 . x=x/2 in coral language
Computers and Technology
1 answer:
Vinil7 [7]4 years ago
5 0

Answer: Provided in the explanation section

Explanation:

The full questions says:

write a program that takes in a positive integer as input, and output a string of 1's and 0's representing the integer in binary. for an integer x; the algothm is as long as x is greater than 0 output x % (remainder is either 0 or 1 . x=x/2 in coral language. Note: The above algorithm outputs the 0's and 1's in reverse order.

Ex: If the input is:

6

the output is:

011

CODE:

#include <stdio.h>

int main() {

   int n;

   scanf("%d", &n);

   while (n > 0) {

       printf("%d", n % 2);

       n /= 2;

   }

   printf("\n");

   return 0;

}

2

#include <stdio.h>

int main() {

   int n;

   scanf("%d", &n);

   while (n > 0) {

       printf("%d", n % 2);

       n /= 2;

   }

   return 0;

}

cheers i hope this helped !!

You might be interested in
Using the employment websites, search for part-time jobs that relate to the career fields you are interested in pursuing or to y
arsen [322]

In order to start a part time job first we have to do some research in particular criteria they are Research your degree and occupational information and industry information.

Explanation:

There are many part- time jobs, they are web developer, sales representative, interpreter and translator and content writer.

There are various websites for this kind of jobs. For example in Quicker, Monster and indeed .com are some of the websites.

The we developer job is creating website for the customer based on the requirements. Example school management, library management.

Then comes data entry job it is a simple job that is to enter the captcha and correcting errors in files and copy pasting job.

Content writer is a job in which the different types of questions are answered for the U.S based companies.

7 0
3 years ago
Read 2 more answers
Give an original idea for an app idea to do with sports, please.
BlackZzzverrR [31]
Maden Mobile is an app for sports :)
5 0
4 years ago
Which option can be used to access more settings than are available in the Backstage view?
Sedaia [141]

Answer:

Orientation settings

Explanation:

Orientation setting or general settings, we can find more options in Excel, we can make general and even advance setting with these options in the backstage view, the language and tabs can be changed in this section, the options are:

  • General
  • Formulas
  • Proofing
  • Save
  • Language
  • Advanced
  • Customize Ribbon
  • Quick access toolbar
  • Add-ins
  • Trust Center
6 0
4 years ago
Read 2 more answers
Ik this isnt an assignment question, but can ya'all friend me? Im lonely ;-; lol
Elan Coil [88]

Answer:hi I’m lonely too

Explanation

:)

4 0
3 years ago
What should you do before you share your information on the internet?
satela [25.4K]

You have to think about, what could happen to you if you shared this information.

Hope this helped!

~Izzy

4 0
4 years ago
Other questions:
  • Write a program that defines a type for a structure that stores information on a student in ENG EK 125. Declare two variables to
    8·1 answer
  • When are the malls going to open
    5·2 answers
  • The proper hand position for keyboarding.
    7·1 answer
  • A RAID structure ____. is primarily used for security reasons is primarily used to ensure higher data reliability stands for red
    14·1 answer
  • Write a program that prompt the user to enter the coordinate of two points (x1, y1) and (x2,y2), and displays the slope of the l
    10·1 answer
  • In many UNIX/Linux data and configuration files are "fields". Sometimes these fields are separated by:
    13·1 answer
  • Analyze the code and identity the value of variable a,b and c after the code execution. int a=40, b=50, c=60; if(! (a&gt;=40)) b
    15·1 answer
  • What is the term for unsolicited Email​
    15·1 answer
  • You have been on the phone with a user in a remote office for 30 minutes troubleshooting their minor desktop problem. No matter
    6·1 answer
  • What is the difference between margin and padding property?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!