Write a C program that computes the value ex by using the
formula
ex =1+x/1!+x2/2!+x3+3!+………….
Answer / dally
#include<stdio.h>
int main()
{
char c = 'X';
int i,n,sum = 0;
printf("Enter values for n\n");
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
sum = sum+power(c,i)/fact(i);
}
fact(int i)
{
int p=1 ,fact;
if(p<=i)
{
fact = p*fact(p++);
}
return fact;
}
Is This Answer Correct ? | 24 Yes | 43 No |
What is 02d in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} what would be the output?
How do i store a paragraph into a string? for example, if i input a long paragraph, the program will read the words one by one and concatenate them until no word is left.
What is operator precedence?
a number is perfect if it is equal to the sum of its proper divisor.. 6 is perfect number coz its proper divisors are 1,2 and three.. and 1+2+3=6... a number is deficient if the sum of its proper divisor is less than the number.. sample: 8 is deficient, coz its proper divisors are 1,2 and 4, and 1+2+4=7. abundant number, if the sum of its proper divisor is greater than the number.. sample..12 is abundant coz 1+2+3+4+6=16 which is geater than 12. now write a program that prompts the user for a number, then determines whether the number is perfect,deficient and abundant..
Write a program to generate the first n terms in the series --- 9,11,20,31,...,82
24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?
what is the difference between declaration ,defenetion and initialization of a variable?
State two uses of pointers in C?
Is it possible to run a c program without using main?If yes HOW??
What is chain pointer in c?
write the output of following code .. main() { static int a[]={10,20,30,40,50}; int *ptr=a; static int arr[2][2]={1,2,3,4}; char str[]="ABCD * 4#"; char *s=str+2; int i,j; for(i=0;i<5,i++) printf("%d",*ptr++); for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d\n",*(*(n+i)+j)); printf("%c\n%c\n%c\n",*(str+2),*s++,*--s); }