logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • C program to find the factorial of a given number


  • Correct Answer
  • #include int main(){ int i=1,f=1,num; printf("Enter a number: "); scanf("%d",&num); while(i<=num){ f=f*i; i++; } printf("Factorial of %d is: %d",num,f); return 0; } Sample output: Enter a number: 5 Factorial of 5 is: 120 


  • Programming problems


    Search Results


    • 1. Write a program to generate the Fibonacci series in c?
    • Discuss
    • 2. Swap two variables without using third variable.
    • Discuss
    • 3. Why we use do-while loop in c?
    • Discuss
    • 4. Write a c program to create dos command type.
    • Discuss
    • 5. What will be output when you will execute following c code? #include enum actor { SeanPenn=5, AlPacino=-2, GaryOldman, EdNorton }; void main() { enum actor a=0; switch(a) { case SeanPenn: printf("Kevin Spacey"); break; case AlPacino: printf("Paul Giamatti"); break; case GaryOldman:printf("Donald Shuterland"); break; case EdNorton: printf("Johnny Depp"); } }

    • Options
    • A. Kevin Spacey
    • B. Paul Giamatti
    • C. Donald Shuterland
    • D. Johnny Depp
    • Discuss
    • 6. Write a c program to check whether a number is strong or not.
    • Discuss
    • 7. Write a c program to print multiplication table
    • Discuss
    • 8. Write a c program for selection sort.
    • Discuss
    • 9. Write a c program for quick sort.
    • Discuss
    • 10. Write a c program for insertion sort.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment