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.

Recommended Answers

All 7 Replies

And what is your question? That's just a homework assignment you posted.

commented: Well the implied question was "Is this a site which dishes out free answers to lazy noobs?" Which the answer is of course "no", and that's why they've gone to infest somewhere else +29

i figured how 2 solve q4 now but i tried 2 solve 1,2,3 i cant do anything .

no one answer me

what don't you understand about those problems?

Q1: once you know what Pythagorean triples are then the rest is not difficult. Try to write the program yourself, and post the code you have written if you still can not solve the problem.

If you was able to do Q4 then you should be able to do the others, because I think Q4 is more difficult than the others.

commented: Oh, I didn't know it is called a 'Pythagorean triple' in English :) +2

i figured how 2 solve q4 now but i tried 2 solve 1,2,3 i cant do anything .

bull crap.

you did not just spontaneously "figure out" how to write the code for Q4, and yet still remain completely helpless to even begin Q1 - Q3. because Q4 combines all the elements of programming that you would need to know for Q1 - Q3

what happened is, someone gave you the answer for Q4, or you found it on another site, and now you're still waiting for someone here to give you the rest of the answers.

until you show some of your work so far -- and ask a meaningful question -- you're just going to be ignored.


.

commented: Damn straight. +29

thanx a lot

no problem. any time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.