Question 1:
Write a program that reads repeatedly 3 integers a, b, and c and test if they are Pythagorean triples. Whether or not .
Your program should keep reading in triples until all three values entered are zero. When
The user enters three zeroes, it should exit without printing anything additional.
If the user types three zeroes the very first time, your program should still exit without printing anything.
A sample run of the program is shown below.
Question 2:
Write a program that lets you play the “High/Low” guess game.
The program should choose a number between 1 and 100, inclusive, but not tell you
what its number is. This is the computer's number.
The program should then prompt you to guess the computer's number. After you type
in each guess, the computer will indicate if your guess was higher, lower, or correct.
If your guess was not correct, the program should allow you to continue guessing.
Note:
Use the rand() function to generate random numbers in the following fashion:
srand( time(NULL)); // this statement will allow you to get different random numbers in each run. If you don’t put it, the computer will generate the same random number in each run.
rand()%100 will generate a random number between 0 and 99. By adding 1, you get a random number between 1 and 100. This will be the random number generated by the computer.
You need to include <stdlib.h>
Question 3:
Using do-while, Write a program to check that the user has typed a letter. The program will not stop until the user types a small or capital letter. Sample runs are shown below.
Note: Use getchar() to skip the new line character after reading each character.
Question 4:
Write a program that reads a file data.txt shown below character by character. It then displays the number of digits, small letters, capital letters, and other characters as shown in the output of the program.
Note : The digits are represented internally by integer numbers forming an interval with increasing numbers from ‘0’ to ‘9’. Thus any digit belongs to the interval [‘0’,’9’]. Don’t use the codes in the condition checking; use the characters themselves. The same applies for letters i.e. a small letter belongs to the interval [‘a’,’z’], and a capital letter belongs to the interval [‘A’,’Z’]. If you don’t take care of checking new line character, you will get 13 for the number of other characters.