C Language 
/* Write a C program to find the sum of cos(x) series */
#include void main() printf(“Enter the number of the terms in aseries\n”); printf(“Enter the value of x(in degrees)\n”); x1=x; x=x*(3.142/180.0); /* Degrees to radians*/ cosx=1; sign=-1; for(i=2;i<=n;i=i+2) for(j=1;j<=i;j++) cosx=cosx+(pow(x,i)/fact)*sign; printf(“Sum of the cosine series = %7.2f\n”,cosx); } /*End of main() */ /*——————————————————–
#include
{
int n,x1,i,j;
float x,sign,cosx,fact;
scanf(“%d”,&n);
scanf(“%f”,&x);
{
fact=1;
{
fact=fact*j;
}
sign=sign*(-1);
}
printf(“The value of cos(%d) using library function = %f\n”,x1,cos(x));
Output
Enter the number of the terms in aseries
5
Enter the value of x(in degrees)
60
Sum of the cosine series = 0.50
The value of cos(60) using library function = 0.499882
——————————————————–*/
/* Write a c program to multifly given number by 4 *
* using bitwise operators */
#include
void main()
{
long number, tempnum;
printf(“Enter an integer\n”);
scanf(“%ld”,&number);
tempnum = number;
number = number << 2; /*left shift by two bits*/
printf(“%ld x 4 = %ld\n”, tempnum,number);
}
/*——————————
Output
Enter an integer
15
15 x 4 = 60
RUN2
Enter an integer
262
262 x 4 = 1048
———————————*/
/* Write a C program to convert the given binary number into its equivalent decimal */
#include
void main()
{
int num, bnum, dec = 0, base = 1, rem ;
printf(“Enter the binary number(1s and 0s)\n”);
scanf(“%d”, &num); /*Enter maximum five digits or use long int*/
bnum = num;
while( num > 0)
{
rem = num % 10;
dec = dec + rem * base;
num = num / 10 ;
base = base * 2;
}
printf(“The Binary number is = %d\n”, bnum);
printf(“Its decimal equivalent is =%d\n”, dec);
} /* End of main() */
/*—————————————————
Outpput
Enter the binary number(1s and 0s)
1010
The Binary number is = 1010
Its decimal equivalent is =10
—————————————————-*/