Write a C program to find the value of Sine(X).
#include<stdio.h> #include<conio.h> #include<math.h> int sine(int); int fact(int); void main() { int x; float result; clrscr(); printf("Enter the value to calculate Sin(x) : "); scanf("%d",&x); result = sine(x); printf("The value of Sin(%d) = %f",x,result); getch(); } int sine(int x) { int i=1,n,m,a,b,cond=0; float temp=0; printf("\nEnter the iteration : "); scanf("%d",&n); for(m=1;m<=n;m++) { a = pow(x,i); printf("%d\n",a); b = fact(i); printf("%d",b); if(cond%2==0) { temp = temp+(a/b); printf("%d\n",temp); cond = cond+1; } else { temp = temp-(a/b); printf("%d\n",temp); cond = cond+1; } i = i+2; } return temp; } int fact(int p) { if(p==0) return(1); else { p = p*fact(p-1); } printf("\nFact = %d",p); return(p); }
Write a C program to find both the largest and smallest number in list of integers.
Write a C program to find the multiplication table of any no.
Eliminate left recursion from the following grammar: