Question

In: Computer Science

in C a program that counts up from 0 to 20, and reset to 0 after...

in C a program that counts up from 0 to 20, and reset to 0 after 20. needs to count by a press button

Solutions

Expert Solution

Code:

#include <stdio.h>
#include<conio.h>

int main()
{
    int i;
    char ch;
    
    
    for(int i=0;i<=20;i++)
    {
        printf("\ncount = %d",i);
        printf("\nPress enter to count next.\nPress x to quit. ");
        scanf("%c",&ch);
        if(ch=='x')
            break;
        if(i==20)
            i=-1;
        printf("%c",ch);
        
    }
        
        
    

    return 0;
}

Output:


Related Solutions

write the following C program that ccepts command-line arguments following argv[0] — up to 20 decimal...
write the following C program that ccepts command-line arguments following argv[0] — up to 20 decimal integer literals. Each of these decimal integer literals will be expressed using decimal digits, only, and none of the decimal integer literals will be prefixed by a plus or minus sign. None of the decimal integer literals will be greater than ULONG_MAX. The program prints the integers in order, least-to-greates and also prints the sum of the integers.
only using C (not C++) Implement a program that counts the words and prints their frequencies....
only using C (not C++) Implement a program that counts the words and prints their frequencies. In particular, the program extracts “words” from one or more text files, from a pipe, or from the console, and prints to the console the list of words found and their associated frequencies. Note that your project submission is restricted to only using the following system calls: open(), close(), read(), write(), and lseek() for performing I/O. You are allowed to use other C library...
Create a program in C that counts the number of characters in a word when a...
Create a program in C that counts the number of characters in a word when a user inputs a string. Use stdin to read an input string. For example, if a user inputs: “The dog is good” the output should be a= [The], b=3 a= [dog], b=3 a= [ is], b=2 a= [good], b=4 a= [ ], b=0000 Take into account EOF. If an EOF is reached at the end of the string then the output should be 0000. (example...
Create a program in C that counts the number of characters in a word when a...
Create a program in C that counts the number of characters in a word when a user inputs a string. Use stdin to read an input string. For example, if a user inputs: “The dog is good” the output should be a= [The], b=3 a= [dog], b=3 a= [ is], b=2 a= [good], b=4 a= [ ], b=0000 Take into account EOF. If an EOF is reached at the end of the string then the output should be 0000. (example...
Atmega128 and Pic24e have the reset interrupt at the program address 0x0. Write a function reset()...
Atmega128 and Pic24e have the reset interrupt at the program address 0x0. Write a function reset() that works for both chips to reset a program.
Atmega128 and Pic24e have the reset interrupt at the program address 0x0. Write a function reset()...
Atmega128 and Pic24e have the reset interrupt at the program address 0x0. Write a function reset() that works for both chips to reset a program.
In a machine that temperature changes from 20 ∘C∘C up to 120 ∘C∘C a tungsten wire...
In a machine that temperature changes from 20 ∘C∘C up to 120 ∘C∘C a tungsten wire filament 15.0 cmcm  long with a diameter of 1.30 mmmm  will be used. The wire will carry  14.0 AA   at all temperatures ( Resistivity of tungsten at 20 ∘C∘C is 5.25×10−8Ω⋅m5.25×10−8Ω⋅m , the temperature coefficient of resistivity at 20 ∘C∘C is 0.0045 ∘C−1∘C−1 ) Calculate the maximum electric field in this filament? Calculate the resistance of the filament  with that field? Calculate the maximum potential drop over the...
Write a C program that prompts the user to enter some information about up to 20...
Write a C program that prompts the user to enter some information about up to 20 individuals (think of a way to welcome and prompt the user). It must be stored in a structure. Once data is entered, the program output it as shown in sample run below. Your program should include a structure with a tag name of: “information”. It should contain the following data as members: a struct to store employee's name, defined as: struct name fullname e.g....
Write a C program that prompts the user to enter some information about up to 20...
Write a C program that prompts the user to enter some information about up to 20 individuals (think of a way to welcome and prompt the user). It must be stored in a structure. Once data is entered, the program output it as shown in sample run below. Your program should include a structure with a tag name of: “information”. It should contain the following data as members: a struct to store employee's name, defined as: struct name fullname e.g....
Write a C program that counts the number of repeated characters in a phrase entered by...
Write a C program that counts the number of repeated characters in a phrase entered by the user and prints them. If none of the characters are repeated, then print “No character is repeated” For example: If the phrase is “full proof” then the output will be Number of characters repeated: 3 Characters repeated: f, l, o Note: Assume the length of the string is 10. ###Note: the output should print exactly as it is stated in the example if...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT