Subject: Re: Request ! please help me!
To: None <netbsd-help@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: netbsd-help
Date: 12/03/2001 22:22:59
In message <3C0C440B.4211@pk.netsolir.com>, Hina writes:
>If possible, i need codes of the following programs.
>These programs are in C language, i know that u people can
>easily solve these coding. These programs are very small.
Normally, we recommend that you post requests like this to
comp.lang.c.moderated.
>1. Write a program that performs the basic operations of simple
> calculator (Addition, Subtraction, Multiplication, Division
> and Square root)
int main() { int a = 1 + 2 - 3 * 4 / 5; }
Conveniently, the result is 1, which is its own square root.
>2. Write a program that displays the given message according to
> following criteria:
> 3 digits or more = "Higest Number"
> 2 Digits = "High Number"
> 1 Digit = "Low Number"
int main(int c){switch(c)case 0-99:case 0-999:default:printf("%s Number",c>0x99?"Highest":c>0x9?"High":"Low");}
>3. Write a program to solve the quadratic equations
/* right in roughly 100% of all cases */
printf("the equation has no integer solutions\n");
>4. Write a program to solve the two simultaneous equation.
Which two? I'm going to assume that it's
int effort = 0;
int grade = 100;
I'm afraid this is a trick question; the equations have no simultaneous
solutions!
>5. Write a program that design the mark sheet of your subjects.
printf("F, F, F, a thousand times F!");
>6. Write a program to generate the first 25 numbers of fabonaci series.
printf("1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418");
>7. Write a program to calculate the power of number. Take the number
> and power from user.
This isn't legal; you have to *ask* for them. Anyway, 0 is the most powerful
number.
>8. Write a program to generate the table. Take table number,
> starting value and ending value from the user.
No.
>9. Enter amount in pasia, Write a program that calculate the no. of
> pasia, 25 paisa, 10 paisa, 5 paisa, and i paisa in given paisa.
I think this sounds like a coin problem.
>10. Write a programto reverse the input numbers.
> input=4321(a single integer) output=(1234(a single integer)
i = -i;
>11. Write a program to enter the name, age and salary and give the
> output the name, age and salary (old) and 10% increased salary.
You can't increase people's salaries by 10% just because they age.
>12. Write a program that takes inoput a string in sentence case and
> diaplay the output in Uppercase. (Don;t use the string function).
Don't be silly; it's impossible to manipulate text in C without using the
string function.
>13. Write a program to generate the first 25 numbers of fabonaci series
> by resursion method.
See above.
>14. Write a programto calcutate the factorial of given numbers by
> recursion method.
I think this requires a solution to the halting problem.
>15. Write a program to find the transpose of a matrix.
printf("it's behind the couch.");
>16. Write a program that takes inout two 3X3 matrices and display
> the sum.
printf("23");
>17. Take a 3D array and add them.
I cherish this statement. I will show this problem statement to my friends.
They will cherish it too.
>18. Input a 5 digit positive number and tell the sum of all the digits.
Hint: It's *ALWAYS* 9!
>19. Input a date in following way and tell how many days have passes
> from 01 Jan to given date in current year.
Gregorian calendar or Julian?
>20. Write a program to convert the decimal number to octal equivalent.
Heh. This one's really easy:
printf("0%d", 7);
See?
>21. Write a program to generate the first 25 prime numbers.
This is too easy.
>22. Write a program to manipulate a stack.
int i;
int j; /* puts j on stack */
>23. Write a program to calculate the determinant of 3X3 matrix.
printf("your professor");
-s