Question

Write a program in C that could be used to get a character, an unsigned decimal...

Write a program in C that could be used to get a character, an unsigned decimal integer, and another single character.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>
int main()
{
printf("enter:");
char ch1,ch2;
int n;
scanf("%c",&ch1);
scanf("%u",&n);
scanf("\n%c",&ch2);//only thing I did extra is i had put '\n' before format specifier
printf("_%d_%u_%c_",ch1,n,ch2);
return 0;
}

Output:

Note:- Due to some reasons

Add a comment
Know the answer?
Add Answer to:
Write a program in C that could be used to get a character, an unsigned decimal...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The left-shift operator can be used to pack two character values into an unsigned integer variable....

    The left-shift operator can be used to pack two character values into an unsigned integer variable. Write a program that inputs two characters from the keyboard and passes them to function packCharacters. To pack two characters into an unsigned integer variable, assign the first character to the unsigned variable, shift the unsigned variable left by 8- bit positions and combine the unsigned variable with the second character using the bitwise inclusive OR operator. The program should output the characters in...

  • Write a BNF grammar that accepts an unsigned decimal number. This number can contain a single decimal point, if it does it cannot be the first character in the string, nor may it be the last. 5. W...

    Write a BNF grammar that accepts an unsigned decimal number. This number can contain a single decimal point, if it does it cannot be the first character in the string, nor may it be the last. 5. Write a BNF grammar that accepts an unsigned decimal number. This number can contain a single decimal point, if it does it cannot be the first character in the string, nor may it be the last. [4 marks] 5. Write a BNF grammar...

  • Write a function to show a character's description. write a function that takes an unsigned character...

    Write a function to show a character's description. write a function that takes an unsigned character c as a parameter and prints c's description. The description of 'a' is just a. But the description of '\n' (the newline character) should be \n, or some other desriptive name, such as newline. Use descriptive names for the tab ('\t') and space characters as well. For an unprintable character whose integer code is m, use description \m. For example, the character with code...

  • BNF 5. Write a BNF grammar that accepts an unsigned decimal number. This number can contain...

    BNF 5. Write a BNF grammar that accepts an unsigned decimal number. This number can contain a single decimal point, if it does it cannot be the first character in the string, nor may it be the last.

  • (Packing Characters into an Integer) The left-shift operator can be used to pack four character values into a four-byt...

    (Packing Characters into an Integer) The left-shift operator can be used to pack four character values into a four-byte unsigned int variable. Write a program that inputs four characters from the keyboard and passes them to function packCharacters. To pack four characters into an unsigned int variable, assign the first character to the unsigned intvariable, shift the unsigned int variable left by 8 bit positions and combine the unsigned variable with the second character using the bitwise inclusive OR operator....

  • Write in C. Simple Program (beginner) Assignment: Write a program Character Pointers and Functions. (like program...

    Write in C. Simple Program (beginner) Assignment: Write a program Character Pointers and Functions. (like program #5-5). Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count. <END>

  • Write a C++ Program to do following: 1. Read every character from file char.txt using "get"...

    Write a C++ Program to do following: 1. Read every character from file char.txt using "get" and write it to a file char.bak using "put" 2. Read every second character from file char.txt using "get" and write it to a file charalternate.txt using "put" and "ignore" 3. Take input from user for offset and number of characters. For example if user enters 5 for offset and 10 for number of characters, then your program should copy 10 bytes from file...

  • SOLVE IN C: 6.26 LAB: Contains the character Write a program that reads an integer, a...

    SOLVE IN C: 6.26 LAB: Contains the character Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Assume that the list will always contain less than 20 words. Each word will always contain less...

  • C++ SECTION 1) (15 points) Write a full C++ program that reads an integer, a list...

    C++ SECTION 1) (15 points) Write a full C++ program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Ex: If the input is: 4 hello zoo sleep drizzle z then the output is: 200 drizzle To...

  • Write a C++ program that asks the user to read one character. Pass the character to...

    Write a C++ program that asks the user to read one character. Pass the character to a function called Binary. Convert the character into its corresponding binary code, then print the character and its corresponding binary code.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT