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
Katyanochek1 [597]
3 years ago
8

Defining a hexadecimal number as in Problem 67, write the function int hexToDec( const int hexNum[]) to convert a four-digit hex

adecimal number to a nonnegative decimal integer. Do not output the decimal integer in the function. Test your function with interactive input.
Computers and Technology
1 answer:
lyudmila [28]3 years ago
3 0

Answer:

#include <stdio.h>

int hexToDec(const int hexNum[]){

   int result = 0, prod = 1;

   for(int i = 3;i>=0;i-=1){

       result += (prod*hexNum[i]);

       prod = prod * 16;

   }

   return result;

}

int main()

{

   int hexNum[4], i;

   char s[5], ch;

   printf("Enter hexa decimal value: ");

   scanf("%s",s);

   

   for(i = 0;i<4;i++){

       ch = s[i];

       if(ch>='0' && ch<='9'){

         hexNum[i] = ch-'0';

      }

      else if((ch>='a' && ch<='f') || (ch>='A' && ch<='F')){

         if(ch=='A' || ch=='a'){

            hexNum[i] = 10;

         }

         else if(ch=='B' || ch=='b'){

            hexNum[i] = 11;

         }

         else if(ch=='C' || ch=='c'){

            hexNum[i] = 12;

         }

         else if(ch=='D' || ch=='d'){

            hexNum[i] = 13;

         }

         else if(ch=='E' || ch=='e'){

            hexNum[i] = 14;

         }

         else{

            hexNum[i] = 15;

         }

      }

   }

   

   printf("%d",hexToDec(hexNum));

   return 0;

}

Explanation:

You might be interested in
Without any formal planning, the president of a software company remarks in a speech that new technologically advanced software
Sphinxa [80]

Answer: The reducing project duration was caused by the emergence of new technology.

Explanation:

Emerging technologies are technologies whose development, practical applications, or both are still largely unrealized, such that they are figuratively emerging into prominence from a background of nonexistence or obscurity.

5 0
3 years ago
Can anyone tell me what's wrong with my pc. When I turn it on it lights up the ram, motherboard, and fans. The cooler and case f
Mice21 [21]

1 or 2 ways I can try to figure out and see what is causing your computer to do this. 1 when was the last time you shut off  OR was doing on the computer? If your problem gets fixed make sure you close all running apps so the apps don't update while your computer is shutdown. 2 did you or something unplug the cables? Or maybe a virus caused something. Try to unplug every cable and wait about 5-10 minutes and if your computer is still not working, I would advise contacting an administrator.

Hope this helped.

6 0
3 years ago
What is 4365 −3412 when these values represent
Inessa [10]

The result of the subtraction of 4365 and 3412 using octal numbers is of:

753.

<h3>What are octal numbers?</h3>

For octal numbers, each number is represented by three bits, as follows:

  • 0 = 000.
  • 1 = 001.
  • 2 = 010.
  • 3 = 011.
  • 4 = 100.
  • 5 = 101.
  • 6 = 110.
  • 7 = 111.

Then the binary representation of number 4365 is given as follows:

100011110101

The binary representation of number 3412 is given as follows:

011100001010

Then the following binary subtraction is made:

100011110101 - 011100001010

The result of this subtraction is of:

100011110101 - 011100001010 = 111101011

Then the octal result is given as follows:

111 101 011 = 753.

More can be learned about binary numbers at brainly.com/question/8649831

#SPJ1

4 0
11 months ago
PLEASE HELP!!! 18 points
sdas [7]

Answer:

Vertigo                                            |     1958 |      128 | English         | 1958-08-24 | UK

   902 | The Innocents                                      |     1961 |      100 | English         | 1962-02-19 | SW

   903 | Lawrence of Arabia                                 |     1962 |      216 | English         | 1962-12-11 | UK

   904 | The Deer Hunter                                    |     1978 |      183 | English         | 1979-03-08 | UK

   905 | Amadeus                                            |     1984 |      160 | English         | 1985-01-07 | UK

   906 | Blade Runner                                       |     1982 |      117 | English         | 1982-09-09 | UK

   907 | Eyes Wide Shut                                     |     1999 |      159 | English         |            | UK

   908 | The Usual Suspects                                 |     1995 |      106 | English         | 1995-08-25 | UK

   909 | Chinatown                                          |     1974 |      130 | English         | 1974-08-09 | UK

   910 | Boogie Nights                                      |     1997 |      155 | English         | 1998-02-16 | UK

   911 | Annie Hall                                         |     1977 |       93 | English         | 1977-04-20 | USA

   912 | Princess Mononoke                                  |     1997 |      134 | Japanese        | 2001-10-19 | UK

   913 | The Shawshank Redemption                           |     1994 |      142 | English         | 1995-02-17 | UK

   914 | American Beauty                                    |     1999 |      122 | English         |            | UK

   915 | Titanic                                            |     1997 |      194 | English         | 1998-01-23 | UK

   916 | Good Will Hunting                                  |     1997 |      126 | English         | 1998-06-03 | UK

   917 | Deliverance                                        |     1972 |      109 | English         | 1982-10-05 | UK

   918 | Trainspotting                                      |     1996 |       94 | English         | 1996-02-23 | UK

   919 | The Prestige                                       |     2006 |      130 | English         | 2006-11-10 | UK

   920 | Donnie Darko                                       |     2001 |      113 | English         |            | UK

   921 | Slumdog Millionaire                                |     2008 |      120 | English         | 2009-01-09 | UK

   922 | Aliens                                             |     1986 |      137 | English         | 1986-08-29 | UK

   923 | Beyond the Sea                                     |     2004 |      118 | English         | 2004-11-26 | UK

   924 | Avatar                                             |     2009 |      162 | English         | 2009-12-17 | UK

   926 | Seven Samurai                                      |     1954 |      207 | Japanese        | 1954-04-26 | JP

   927 | Spirited Away                                      |     2001 |      125 | Japanese        | 2003-09-12 | UK

   928 | Back to the Future                                 |     1985 |      116 | English         | 1985-12-04 | UK

   925 | Braveheart        

Explanation:

hope this helped please mark me branliest let me know if you have questions :)

5 0
3 years ago
An online electronic journal is known as a _____.
fredd [130]

Answer: as an e-journals

Explanation:

8 0
3 years ago
Other questions:
  • ASAP HELP NO GUESS A new pet store wants to design a logo to be displayed on business cards, posters in the shop’s windows, and
    9·2 answers
  • How to copy single slide to powerpoint
    15·1 answer
  • The countryside presents
    11·1 answer
  • Que funcion tiene la sombrilla forrada de aluminio​
    6·1 answer
  • Eight what makes one character
    14·1 answer
  • WHAT THE DEFINITION OD ENGINEER. No CHEAT
    5·2 answers
  • What is the difference between word processing software and email?
    12·2 answers
  • Functions of barriers include (mark all that apply): A. Define boundaries B. Design layout C. Deny access D. Delay access
    10·1 answer
  • Ask how many apples the user wants. Ask how many people the user will share the apples with. Find out how many apples will remai
    7·1 answer
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!