Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------
- // hw2.c
- //
- // This program calculates the
- // factorial of every second number
- // from my Matrikelnumber
- //
- // Group: Group 1, study assistant Severin-Holzgraf
- //
- // Authors: Roland Urbano 1130357
- //------------------------------------------------------------------------------
- //
- #include <stdio.h>
- //------------------------------------------------------------------------------
- //
- // This is the main function where the factorial is calculated
- //
- int main ()
- {
- int summ = 20; //summ of matr_number
- double modulo = summ % 2;
- double counter = 0;
- double max_wert = 0;
- double factorial = 1; //Variable zum speichern der Fakultät
- while (modulo != 1)
- {
- while ( counter <= max_wert )
- {
- factorial = factorial * counter;
- counter++;
- }
- printf("%e\n", factorial);
- max_wert = max_wert + 2;
- while ( counter == summ)
- {
- modulo = 1;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment