Advertisement
Jkljk

funçao fatorial com while

Aug 12th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int fat, n;
  6.     char d;
  7.    do{
  8.    printf("digite um numero:");
  9.    scanf("%d",&n);
  10.  
  11.    for(fat = 1; n > 1;n = n - 1){
  12.    fat=fat*n;
  13.    }
  14.    printf("fatorial = %d\n", fat);
  15.     printf("s ou n:?");
  16.    scanf("%s",&d);
  17.     }
  18.    //
  19.     while ( d =='s'|| d =='S');
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement