Jump to content
Fórum Script Brasil
  • 0

binomio de newton em C


Estou fazendo um programa pra faculdade que tem que calcular  uma soma dupla vezes um coef. B. Porém o valor de B é sempre zero e os da somatoria não são corretos.

#include <stdio.h>
#include <math.h>   
#include <stdlib.h>
double fatorial(double w){
double fat;
for(fat = 1; w > 1; w = w - 1)
fat = fat * w;
 return fat;

  int main(){
        int p, l, k, i, N;
        double B, func, n, m, somatorio1, somatorio2, soma = 0., b;;
    printf("Digite os valores de n m :\n");
    scanf("%lf %lf", &n, &m);
    N = n + m;
    for(k = 0; k <= N; k++){
    func =  fatorial(k) / ( pow(2, N) * fatorial(n) * fatorial(m));
        B = sqrt(func);

    for(p = 0;p <= n; p++){
        for(l = 0;l <= m; l++){ 
            if(p+l == k){
                somatorio1 = pow(-1, p) *(fatorial(n) / (fatorial(p) * fatorial(n - p)));
                somatorio2 = fatorial(m) / (fatorial(l) * fatorial(m - l)); 
                soma = soma + somatorio1 * somatorio2;
printf("%d %lf\n", k, soma);
       return 0;

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Forum script Brasil is a website which includes many posts for discussion. It has a question of net newton em C which is about their hashtags and alphabets of a keyboard. I prefer to check  https://do-my-assignment.com/research-paper-writing-service-australia/ site to learn more new ways to complete their assignments. You can also post your answer on it. Join their website for posting your.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...