# Thread: How can i create algoritma for this question

1. ## How can i create algoritma for this question

In this part of the project, main purpose is to get the secret code from the computer. There are five questions to be answered. In each question, user will face a problem and all problems are related to the solution of the previous problem. Before solving the problem, it is not possible to move to the next question. First question will start with the day the user was born. That means each code is specific for each user. When user reaches and solves the fifth problem he/she will get the key code.
Here are the questions:
1) Please enter the numeric day of your birthday between 1 and 7 (example Mon=1, Tue=2). If user enters number that is not between 1 and 7, then print error and ask number again.
Lets assume the result of question 1 is x.
2) What is the xth power of n (i.e. nx)? Here, n is a number that can only be computed as follows:
Get the initial letter of your name in uppercase (A to Z, others will not be tested). Look at the decimal number that stands for that letter in ASCII table and take the mod of it by 4.
Hint: There is no need to look at the ASCII table, actually. Both in Labs and MT1, we have shown you the trick.
For example, Oguzhan is my name. Initial letter of my name is O. The number stands for that letter in ASCII table is 79. mod(79,4) = 3. Hence, n = 3.
Also you have to print both the letter and the value n on screen. In order to print in correct way, examine the example below.
Lets assume the result of question 2 is y.
3) How many prime numbers do exist until y? (y is included.)
Hint: A prime number is a whole number greater than 1 that has no positive divisors other than 1 and itself.

For example, there are 9 prime numbers until 27.

Lets assume the result of question 3 is z.
4) Enter zth element of Fibonacci series.
Hint: Fibonacci series is a series of numbers in which each number (Fibonacci number) is the sum of the two preceding numbers. A part of the series is 1, 1, 2, 3, 5, 8,

For example, if z==6, then w=8 .

Lets assume the result of question 4 is w.
5) Finally enter your age and compute w×age (× is multiplication sign), which is the desired keycode.
Remember that program should continue until user enters a correct answer for each question. For 5th question, age should be between 1 and 100, if it is not, you are expected to print the error and ask again.
After 5th question is correctly answered, print Congratulations! You found the code! The code is 
Youre expected to implement the functions below (of course with some parameters and proper return types):

In addition to these methods you can also implement more functions. 2. There isn't much to do except follow the instructions.

I mean it's all printf / scanf and some simple maths.

> You’re expected to implement the functions below (of course with some parameters and proper return types):
So do the first one
- write some code
- compile it
- test it.

You keep doing those things until you're happy that askFirstQuestion() is working properly.

Then you do the whole thing over for askSecondQuestion()

And so on.

Post when you have code and are stuck. 3. i wrote the code for the first quesiton but idk how to use the output of the first question as a input in second question 4. So show us what you have. 5.  6. Copy/paste the code in [code][/code] tags.

Fuzzy pictures are useless for quoting text. 7. Code:
```#include <stdio.h>#include <stdlib.h>

return (a>=1 && a<=7);
}
int main() {
int a;
scanf("%d",&a);

if(a>=1 && a<=7){

printf("%d\n",a);

}
else{

scanf("%d",&a);
printf("%d\n",a);

}
}
return 0;

}

}``` 8. And i need to ask second quesiton to the user but idk how to do it when i use second scanf it doesnt work program just take the first input and stops 9. First off, fix your indentation, it's all over the place.

Code:
```#include <stdio.h>
#include <stdlib.h>

{
return (a >= 1 && a <= 7);
}

int main()
{
int a;
scanf("%d", &a);
if (a >= 1 && a <= 7) {
printf("%d\n", a);
} else {
printf("%d\nPlease enter an appropriate day!\n", a);
scanf("%d", &a);
printf("%d\n", a);
}
}
return 0;
}
}```
Most of the code you have in main should be inside the function.
It should be the one to print the prompt, get an answer and loop until the answer is within range.

```int main( ) { Popular pages Recent additions code, letter, number, question, user 