0
Go4Expert Member
code the function Factorial:
unsigned long long Factorial (unsigned char N)
that computes the expression :
N!=1*2*3*4*5*6........*N
test the function of values of N betw 0 and 20 (inclusive). indicate why the function would not properly compute anything beyond 20!. In this context justify, the return type of the function (unsigned long long)
plz hep me
0
Go4Expert Member
code the function SumNN:
unsigned int SumNN(unsigned char N)
that compute the expression:

∑(from i=0 to N) of i^2=1+2^2+3^2+.......+N^2

justify why N is limited to unsigned char and the return valy is of type unsigned int. Note that the summation is also given by the formula :

∑(from i=o to N) of i^2= (N(N+1)(2N+1))/6

you may use it to confirm your result.
0
Go4Expert Member
for the function SumNN i did this:
Code:
```#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

void main (void)

{
unsigned char N;
char ch;
void SuNN(unsigned char N);
while (1)
{
printf("Enter N:  ");
scanf(" %c", &N);
SuNN(N);
printf("\n Would you like to try again Y/N? ");
scanf(" %c", &ch);
ch = toupper(ch);
if(ch == 'N') break;
}
}
void SuNN(unsigned char N)
{
int i;
int p=1;
for (p<N;i=p*p;p++);
{
printf ("I*I=%d",i);

}
}```
but it did not work so plz help me

Last edited by shabbir; 30Nov2011 at 08:32.. Reason: Code blocks
0
Mentor
>> it did not work

How exactly?
0
Go4Expert Member
it did not give me anythig it only display " would you like to continue Y/N"
0
Mentor
Didn't it even display "Enter N:"? If it did, what input did you give it?
0
Go4Expert Member
WELL it didn't display "Enter N:" it just displayed "would you like to continue Y/N"
0
Mentor
Once, or lots of times?
0
Go4Expert Member
lots of times...
0
Go4Expert Member
sorry i re start the function it gave me enter N and when i enter any number it give me that I*I=0