sum using for loop in c

#include <stdio.h>
#include <stdlib.h>
#include <math.h>


/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	int x,i,n,num, f = 1;
    double k=3,e=2.71828;
    printf("Enter a number to calculate its factorial: ");
    scanf("%d", &x);
    for (x = 1; x <= n; x++){
    f = f *x;
    }  
    printf("enter number to calculate its probability: ");
    scanf("%d",&num);
    if (num=x,num<=10){
		for (i=1;i<=num;i++){
	 double p=((pow(k,x))*(pow(e,-k)))/f;
	 printf("The probability is %f\n",p);}
	}
	else {
		printf("this number is not between 1 to 10");
	}


Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source