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...

  • 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...

  • 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...

  • C program: Write a program that assigns and counts the number of each alphabetic character in...

    C program: Write a program that assigns and counts the number of each alphabetic character in the Declaration of Independence and sorts the counts from the most used to the least used character. Consider upper and lower case letters the same. The frequency of each character should be accumulated in an array. USE POINTERS to increment counts for each letter, sort your array, and display the results. Output should consist of two columns: (1) each letter 'a'-'z' and (2) the...

  • Write a program to subtract large unsigned integers. Your program should prompt and read in two...

    Write a program to subtract large unsigned integers. Your program should prompt and read in two large unsigned integers. The two large integers should be stored arrays, one array for each integer. The integers should be stored with one digit per location in the two arrays. The first integer should be no smaller than the second. Your program should subtract the second integer from the first. The result should be stored in an array, again one digit per location in...

  • Write a program to subtract large unsigned integers. Your program should prompt and read in two...

    Write a program to subtract large unsigned integers. Your program should prompt and read in two large unsigned integers. The two large integers should be stored arrays, one array for each integer. The integers should be stored with one digit per location in the two arrays. The first integer should be no smaller than the second. Your program should subtract the second integer from the first. The result should be stored in an array, again one digit per location in...

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
ADVERTISEMENT