Académique Documents
Professionnel Documents
Culture Documents
opasdfghjklzxcvbnmqwertyuiopasdfgh
jklzxcvbnmqwertyuiopasdfghjklzxcvb
B.TECH IT
nmqwertyuiopasdfghjklzxcvbnmqwer
GE6161 COMPUTER PRORAMMING
tyuiopasdfghjklzxcvbnmqwertyuiopas
dfghjklzxcvbnmqwertyuiopasdfghjklzx
cvbnmqwertyuiopasdfghjklzxcvbnmq
wertyuiopasdfghjklzxcvbnmqwertyuio
pasdfghjklzxcvbnmqwertyuiopasdfghj
klzxcvbnmqwertyuiopasdfghjklzxcvbn
mqwertyuiopasdfghjklzxcvbnmqwerty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
vbnmqwertyuiopasdfghjklzxcvbnmrty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
vbnmqwertyuiopasdfghjklzxcvbnmqw
ertyuiopasdfghjklzxcvbnmqwertyuiop
FIRST SEMESTER
MANUAL
REGULATION 2013
Ex.No:1
AIM:
To create a MS-word document using Formatting tool bar and create
mathematical equations using scientific notations.
PROCEDURE:
1.Open a new document and perform the following tasks:
Ca(HCO3)2
3. Inserting Symbols:
Type the text, then put the cursor where you want to add the
symbol.
Choose symbols options from the Insert menu.
Shows the symbols dialog box. Then choose the appropriate Font
type (normally for symbols Webdings font)
4. Advertisement:
Open a new word document.
Type the heading and select the font as Times New Roman, font style
as Title color and the font size as appropriate.
Select Insert -> Picture -> ClipArt and select the picture.
Select Tools -> Customize -> Toolbars -> Drawing and Word Art.
2
Type the given article and select Format -> Columns and select two
columns.
Insert the given shapes by selecting Auto shapes from the Drawing
Toolbar.
Apply border to the entire page by selecting Format -> Borders and
Shading.
Select View -> Header and Footer and add the necessary details.
Save the document as advertisement.doc.
RESULT:
Ex.No:2
Vehicle
Jan
Feb
Mar
Total
Car
250
300
310
Auto
54
92
20
Jeep
91
120
11
Van
Total
125
119
78
Make sure that appropriate formulas are entered in column E so that total
sale of each vehile is shown properly. Similarly in row 6 type correct
formulas so that total sales for each month is shown in respective column.
Open a new worksheet window
Build the above table starting from cell A1.
Type the formula (=sum(B2:D2)) in cell E2 to get the Total
Drag through the range from (E2 to E5) and then press enter key
Similarly type the formula in cell B6 and drag upto B6 to get the total
for every month
1.Draw a Pie Chart to show vehicle wise total sales made between Jan and
Mar 2011.Total sales of each vehicle must be shown as a sector.
Select the data to be charted.
Choose Chart from the Insert menu or click on the ChartWizard
button.
Select the chart type: Pie and click on the Next button.
Read the dialog box, make sure the range is correct and then click the
Next button
Enter the Chart title, Category (x) axis, value (y) axis and click on next
button to continue
Click once on the As object in radio button and specify the object
name.
Click on the finish button and get the desired chart on the workbook.
Right click the above figure, and select the 3D view to get the
3D view of the above Pie chart.
Car
Auto
Jeep
Van
Total
2. Draw a bar graph/column chart to show sale of vehicles for each month.
Highlight the data to be charted.
Choose Chart from the Insert menu
Choose the Chart type: Column and then select the desired chart subtype from the samples on display. Click on the Next button.
In the dialog box, the default radio button for columns would be
selected. If the range is correct, click on the Next button.
5
Select Titles tab from the dialog box and enter the chart title,
category x axis value, y axis value.
Click on the Legend folio and select the desired placement where the
legends should be displayed. Click on the next button.
Click once on the As object in radio button and specify the object
name.
Click on the finish button and get the desired chart on the workbook.
Right click the above figure, and select the 3D view to get the
3D view of the above column chart.
350
300
250
total
200
Jan
150
Feb
100
Mar
50
Total
Mar
0
Car Auto
Jeep Van
Vehicle
Jan
Month
Total
3. Draw a stacked bar graph to show the sale of each vehicle in comparison
with the total sales for the month.
Highlight the data to be charted.
Choose Chart from the Insert menu
Choose the Chart type: Bar and then select the desired chart sub-type
from the samples on display. Click on the Next button.
In the dialog box, the default radio button for columns would be
selected. If the range is correct, click on the Next button.
Select Titles tab from the dialog box and enter the chart title,
category x axis value, y axis value.
Click on the Legend folio and select the desired placement where the
legends should be displayed. Click on the next button.
Click once on the As object in radio button and specify the object
name.
Click on the finish button and get the desired chart on the workbook.
4. Draw a Line graph to show the sales trend over the first quarter of the
year 2011.
Highlight the data to be charted.
Choose Chart from the Insert menu
Choose the Chart type: Line and then select the desired chart sub-type
from the samples on display. Click on the Next button.
In the dialog box, If the range is correct, click on the Next button.
Select Titles tab from the dialog box and enter the chart title,
category x axis value, y axis value.
Click on the Legend folio and select the desired placement where the
legends should be displayed. Click on the next button.
Click once on the As object in radio button and specify the object
name.
Click on the finish button and get the desired chart on the workbook.
Cost
2.
200000
3.
700000
4.
900000
5.
1000000
In the dialog box, If the range is correct, click on the Next button.
Select Titles tab from the dialog box and enter the chart title,
category x axis value, y axis value.
Click on the Legend folio and select the desired placement where the
legends should be displayed. Click on the next button.
Click once on the As object in radio button and specify the object
name.
Click on the finish button and get the desired chart on the workbook.
Result
10
Ex.No:3
FLOWCHART DRAWING
Aim
To draw a flowchart in Microsoft word.
Procedure
Right click on the tool bars.
Click and include the drawing tool bar .
Click Auto shape.
Select flow chart.
Click on the symbol .Drag on the document. Add text.
Basic Flowcharting Shapes
Flowcharts use special shapes to represent different types of actions or steps
in a process. Lines and arrows show the sequence of the steps, and the
relationships among them.
Start/End
system. It
hdhfjhjsdh
Action or
Process
process.
Document
process
11
emerge fr
symbol has
Flow
Result:
12
Aim
To write a simple menu driven calculator program using switch
statement
Algorithm
Step 1: Start the program
Step 2: Read a, b, c and ch
Step 3: Pass ch to switch statement
Step 4: If ch is +, print c=a+b
Step 5: If ch is -, print c=a-b
Step 6: If ch is *, print c=a*b
Step 7: If ch is /, print c=a/b
Step 8: Print enter correct operator in default case
Step 9: End of program
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,choice;
clrscr();
printf("\n eneter the first no.:");
scanf("%d",&a);
printf("\n enter the second no.:");
scanf("%d",&b);
printf("1.addition \n");
printf("2.subtraction \n");
printf("3.multiplication \n");
13
printf("4.division \n");
printf("0.exit \n");
printf("\n enter your choice:");
scanf("%d",&choice);
switch(choice)
{
case 1:c=a+b;printf("%d",c);break;
case 2:c=a-b;printf("%d",c);break;
case 3:c=a*b;printf("%d",c);break;
case 4:c=a/b;printf("%d",c);break;
case 0:exit(0);break;
default :printf("the choice is out of range \n");
}
getch();
}
OUTPUT:
Enter the first no:3
Enter the second no:2
Enter ur choice:3
6
Result:
2. Control Structures.
Ex.No.4B
MULTIPLICATION TABLE
Aim
To print multiplication table for the given number.
Algorithm
Step 1: Start the program
Step 2: Read number, count value and a
Step 3: Initialize for loop with a=1 and check the condition a<=count value
and
Result:
Ex.No.4C
PALINDROME OR NOT
Aim
To write a C program to check the palindrome of a number
15
Algorithm
Step 1: Start the program
Step 2: Read the number from the user
Step 3: Separate each digit by dividing the number by 10
Step 4: Store the remainder in other variable to reverse the number
Step 5: If the original number is equal to the reversed number then that
number is palindrome
Step 6: If the original number is not equal to the reversed number then
that number is not palindrome
Step 7: Display the result
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int num,b=0,c=0,e;
clrscr();
printf("Enter the number:\n");
scanf("%d",&num);
e=num;
while(num>0)
{
b=num%10;
c=c*10+b;
num=num/10;
}
if(e==c)
{
printf("The number is a palindrome",c);
}
else
{
printf("The number is not a palindrome",c);
}
getch();
}
16
OUTPUT:
Enter the number: 121
The number is a palindrome
Enter the number: 134
The number is not a palindrome
Result:
Ex.No.5A
Aim
To check and print whether the given number is prime number or not.
Algorithm
Step 1: Start the program
Step 2: Read a
Step 3: Check if a=1 and if it yes print 1 is neither a prime number nor a
composite number
Step 4: Initiate b=2 and check b<=a-1 in the while loop, if yes enter the
while loop
Step 5: If a%b=0, print given number is not a prime number
Step 6: If b=a print given number is a prime number
Step 7: End of program
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i;
clrscr();
printf("Enter the number:\n");
scanf("%d",&num);
for(i=2;i<num;i++)
{
if(num%i==0)
{
printf("The number is not a prime number");
break;
17
}
else continue;
}
if(i==num)
printf("The number is a prime number");
getch();
}
OUTPUT:
Enter the number 3
The number is a prime number
Result:
Ex.No.5B
AIM
To write a C program to generate a Fibonacci series.
ALGORITHM
1. 1.Start the program
2. Read the limit n from the user.
3. Assign f1=0,f2=1.
4. Set loop for I and for all i<n value calculate f3=f1+f2.
5. Assign f1=f2 and f2f3.
6. 6.Display f1.
7. 7.Stop the program
Program
#include<stdio.h>
void main()
{
int n,f0=0,f1=1,f2,i;
clrscr();
printf("Enter the number:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
f2=f0+f1; f0=f1;
f1=f2;
printf("%d\t",f2);
}
18
getch();
}
OUTPUT:
Enter the number : 7
The fibannoci series is
0112358
RESULT:
3. Arrays
Ex.No.6A FINDING THE LARGEST AND SMALLEST NUMBER
OF AN ARRAY
AIM:
To write a C program to find the Largest and Smallest number of an array.
ALGORITHM
1. 1.Start the program
2. Read total numbers in an array.
3. Read the numbers in an array.
4. Initialize max=0,and min=32767.
5. Set the loop and check for, all the I element a[i]>max=a[i].
6. Check for all the I value a[i]<min then assign min=a[i].
7. Print the maximum and minimum values after execution of the loop.
8. Stop the program.
Program
#include<stdio.h>
#include<conio.h>
#define n 8
void main()
{
int i,a[10],max,min;
int num[n];
clrscr();
for(i=0;i<n;i++)
{
printf("Enter the numbers one by one \n",a[i]);
scanf("%d",&a[i]);
19
max=a[0]; min=a[0];
}
for(i=1;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
if(a[i]<min)
{
min=a[i];
}
}
printf("The smallest number is %d\n",min);
printf("The largest number is %d",max);
getch();
}
OUTPUT:
Enter the total numbers:5
Enter the numbers one by one:34
78
12
90
56
The largest number is 90
The smallest number is 12
RESULT:
Ex.No.6B
Aim
To Sort numbers in an array in ascending / descending order.
Algorithm
Step 1: Start the program
Step 2: Read n
Step 3: Read n numbers using for loop
20
Step 4: Enter for loops by checking the conditions i<=n-1 and j<n and by
initializing for loops with i=0, j=i+1
Step 5: If (a[i]>a[j]), swap these two variables with another variable temp
Step 6: Print the ascending orders by initializing for loop with i=0 and the
condition is i<n by incrementing i in steps of 1
Step 7: Print the descending order by initializing for loop with i=n-1 and the
condition is i>=0 by decrementing i in steps of 1
Step 8: End of program
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,num[10],temp;
clrscr();
printf("Enter the elements\n");
scanf("%d",&n);
printf("Enter the numbers one by one\n");
for(i=0;i<n;i++)
scanf("%d",&num[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(num[i]>num[j])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
}
printf("\n ASCENDING ORDER\n");
for(i=0;i<n;i++)
printf("%d\t",num[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
21
{
if(num[i]<num[j])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
}
printf("\n DESCENDING ORDER\n");
for(i=0;i<n;i++)
printf("%d\t ",num[i]);
getch();
}
OUTPUT:
Enter the elements:6
Enter the numbers one by one:
34
89
12
67
56
78
ASCENDING ORDER
12
34
56
67
78
89
DESCENDING ORDER
89
78
67
56
34
12
Result:
22
Ex.No.6C
MATRIX ADDITION
Aim
To write a C program to add the two matrices
Procedure
Step 1: Start the program
Step 2: Enter the row and column of the matrix
Step 3: Enter the elements of the A matrix
Step 4: Enter the elements of the B matrix
Step 5: Set a loop for rows
Step 6: Set an inner loop for columns
Step 7: Add the elements of A and B in column wise and kept the result in C
matrix
Step 8: After the execution of the loops, print the C matrix
Step 9: End the program
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int a[25][25],b[25][25],c[25][25];
int i,j,m,n;
clrscr();
printf("Enter the row and column");
scanf("%d%d",&m,&n);
printf("Enter the elements of A matrix:");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("Enter the elements of B matrix:");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&b[i][j]);
23
printf("\nElements of A matrix:");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<n;j++)
printf("\t%d",a[i][j]);
}
printf("\n Elements of B matrix:");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<n;j++)
printf("\t%d",b[i][j]);
}
printf("\nThe addition of two matrics:");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\t%d",c[i][j]);
}
}
getch();
}
OUTPUT:
Enter the row and column:3
Enter the elements of A matrix:5 7 2 9 6 11 4 8 23
Enter the elements of B matrix: 6 8 4 11 7 23 6 35 12
Elements of A matrix:
572
9 6 11
4 8 23
Elements of B matrix:
684
11 7 23
6 35 12
The addition of two matrix:
11 15 6
20 13 34
10 43 35
24
Result:
Ex.No.6D
MATRIX MULTIPLICATION
Aim
To write a program to perform matrix multiplication
Algorithm
Step 1: Start the program
Step 2: Get the order of matrix A and B
Step 3: Check whether the rows of matrix A is equal to columns of matrix B
Step 4: If the condition is true get the values for matrices A and B
Step 5: Initialize i to be zero and check i< rows of matrix B
Initialize j to be zero and check j< columns of matrix B
Step 6: Initialize k to be zero and check k< rows of matrix A
Step 7: Perform d[i][j]=d[i][j] + (a[i][j] * b[i][j]) until the above condition
satisfies
Step 8: Print the resultant matrix d[i][j]
Step 9: End the program
#include<stdio.h>
#include<conio.h>
void main()
{
int a[25][25],b[25][25],c[25][25];
int i,j,k,m,n,p,q;
clrscr();
printf("Enter the row and column of A matrix");
scanf("%d%d",&m,&n);
printf("Enter the row and column of B matrix");
scanf("%d%d",&p,&q);
if(n==p)
{
printf("multiplication is possible");
printf("Enter the elements of A matrix:");
for(i=0;i<m;i++)
25
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("Enter the elements of B matrix:");
for(i=0;i<p;i++)
for(j=0;j<q;j++)
scanf("%d",&b[i][j]);
printf("\nElements of A matrix:");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<n;j++)
printf("\t%d",a[i][j]);
}
printf("\n Elements of B matrix:");
for(i=0;i<p;i++)
{
printf("\n");
for(j=0;j<q;j++)
printf("\t%d",b[i][j]);
}
perintf("\nThe multipliaction of two matrix:");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<q;j++)
{
c[i][j]=0;
for(k=0;k<n;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<q;j++)
printf("\t%d",c[i][j]);
}
}
else
printf("matrix multiplication is not possible");
getch();
26
}
OUTPUT:
Enter the row and column of A matrix:3 3
Enter the row and column of B matrix:3 3
Enter the elements of A matrix:1 2 3 4 5 6 7 8 9
Enter the elements of B matrix:9 8 7 6 5 4 3 2 1
Elements of A matrix:
123
456
789
Elements of B matrix:
987
654
321
The multiplication of two matrix
30 24 18
84 69 54
138 114 90
Result:
4. STRINGS
Ex.No.7A STRING MANUIPULATION WITHOUT USING LIBRARY
FUNCTIONS - STRING CONCATENATION
Aim
To concatenate the given strings without using library functions
Algorithm
Step 1: Start the program
Step 2: Read name1[20], name2[20], i and c
Step 3: Check the condition name1[i] !=\0 in while loop and increment i by
1 until condition fails
Step 4: Check another condition name2[i] !=\0 in while loop and store the
elements of name2 in name1 and increment c by 1 until condition fails
Step 5: Print the concatenated string
Step 6: End of program
27
Program
#include<stdio.h>
#include<conio.h>
void main()
{
Char str1[10],str2[10],str3[40];
int I,j;
clrscr();
printf(Enter the two string:);
scanf(%s%s,str1,str2);
for(i=0;str[i]!=\0;i++)
{
str3[i]=str1[i];
}
for(j=0;str[j]!=\0;j++)
{
str3[i]=str2[j];
i++;
}
str3[i]=\0;
printf(Concatenated string is %s\n,str3);
getch();
}
Output 1
Enter the two string: divya malli
Concatenated string is divyamalli
Output 2
Enter the two string: DIVS Publishers
Concatenated string is DIVSPublishers
28
Result:
Output 2
Enter the first and second string: divya malli
The both string is not equal
Result:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char names[20][20],temp[10];
int i,j,n;
clrscr();
printf("Enter the no of names:");
scanf("%d",&n);
printf("Enter names to sort: \n");
for(i=0;i<n;i++)
{
scanf("%s",names[i]);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(names[i],names[j])>0)
{
strcpy(temp,names[i]);
strcpy(names[i],names[j]);
strcpy(names[j],temp);
}
}
}
printf("The sorted order is:\n");
for(i=0;i<n;i++)
{
printf("%s\n",names[i]);
}
getch();
}
OUTPUT:
Enter the no of names4
Enter names to sort
Bala
Arun
Mala
Sudha
The sorted order is
31
Arun
Bala
Mala
Sudha
RESULT:
5. Functions
Ex.No.8A
BUBBLE SORTING
Aim
To implement bubble sorting in C.
Procedure
Step 1: Start the program
Step 2: Get the total number of elements of the array as n
Step 3: Get the elements of the array
Step 4: Initialize a for loop with i as 1 and continue the loop until the
condition i<n is true and increment i insteps of 1
Step 5: Initialize an inner for loop with j as 1 and continue the loop until the
condition j<=n-1 and increment j insteps of 1
Step 6: Check the condition a[j] > a[j+1] and if so swap the elements
Step 7: Print the sorted elements of the array
Step 8: End the program
Program
#include<stdio.h>
#include<conio.h>
void main()
32
{
int i,n,a[10];
clrscr();
printf("Enter the no of elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
bubble(n,a);
getch();
}
int bubble(int n,int x[])
{
int i,j,temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(x[i]>x[j])
{
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
}
printf("After sorting:");
for(i=0;i<n;i++)
printf("%d\t",x[i]);
}
OUTPUT
Enter the no. of elements
5
10
56
23
89
12
After sorting
10
12
23
56
33
89
Result:
Ex. No.8B
SEQUENTIAL SEARCH
Aim
To perform sequential search operation in an array of elements
Procedure
Step 1: Start the program
Step 2: Get the total number of elements as n
Step 3: Get an elements of the array
Step 4: Get the number to be searched in the array as no
Step 5: Pass the array elements to a function
Step 6: Initialize a for loop with i as 1 and check if i<a[n] and increment i insteps of 1
Step 7: Check if the number to be searched is equal to element in the array,
if so then print the position of the number and the number and get
out of the loop
Step 8: If not so then, print as the number is not in the array
Step 9: End the program
Program
#include<stdio.h>
#include<conio.h>
void seq(int [],int ,int);
void main()
{
int a[50],n,x,i;
clrscr();
printf("Enter the number:");
scanf("%d",&n);
34
OUTPUT:
Enter the number:5
enter the elements:1
2
3
4
5
Enter the number to search:2
Element found
Result:
35
Ex.No.9
Aim
To find the factorial of a number in recursive method
Algorithm
Step 1: Start the program
Step 2: Read n, fact
Step 3: Call the function factorial(n)
Step 4: If n is 0, return 1 and if not return (n*factorial(n))
Step 5: Print fact
Step 6: End of program
Program
#include<stdio.h>
#include<conio.h>
void main()
{
long int factorial(int );
int n;
long int fact;
clrscr();
36
OUTPUT:
Enter the number:5
Factorial of 5 is 20
Result:
else if(s1[i].avg<60)s1[i].grade='S';
else if(s1[i].avg<50)s1[i].grade='T';
}
}
printf("\n The details of the marklist is as follows\n");
printf("\nRollno");
printf("\tName");
printf("\tMark1");
printf("\tMark2");
printf("\tMark3");
printf("\tTotal");
printf("\tAVERAGE");
printf("\tGRADE");
printf("\n");
for(i=1;i<=n;i++)
{
printf("\n%d",s1[i].rollno);
printf("\t%s",s1[i].name);
printf("\t%d",s1[i].m1);
printf("\t%d",s1[i].m2);
printf("\t%d",s1[i].m3);
s1[i].total=s1[i].m1+s1[i].m2+s1[i].m3;
printf("\t%d",s1[i].total);
printf("\t%f",s1[i].avg);
printf("\t%c",s1[i].grade);
}
getch();
}
OUTPUT:
Enter the number of students:2
Enter student number,name,and 3 subjects marks:
Enter the roll number:35
Enter the name:Priya
Enter the Mark1:45
Enter the Mark2:98
Enter the Mark3:78
Enter student number,name,and 3 subjects marks:
Enter the roll number:36
Enter the name:Asha
Enter the Mark1:98
39
Algorithm:
Step1: start the program
Step 2: initialize the union and structure name
Step 3: print size of the union and structure
Program:
#include<stdio.h>
void main()
{
union result
{
int marks;
char grade;
};
struct res
40
{
char name[15];
int age;
char sex;
char address;
int pincode;
union result perf;
}
clrscr();
printf("Size of Union:%d\n",sizeof("data.perf"));
printf("Size of Structure:%d\n",sizeof("data"));
getch();
}
Output:
Size of Union:10
Size of Structure:5
RESULT:
clrscr();
printf("c.a value is %d\n",c.a);
printf("c.b[0] value is %d\n",c.b[0]);
printf("c.b[1] value is %d\n",c.b[1]);
getch();
}
Output:
c.a value is 256
c.b[0] value is 0
c.b[1] value is 1
RESULT:
Aim: Program to print the following series until there sum exceeds 2.6 term value exceeds 1.5
x+x2/2!+x3/3!+------------.
Program:
#include<stdio.h>
#include<conio.h>
main( )
{
float x,sum=0,prod=1;
int i;
clrscr( );
printf(enter x value);
scanf(%f,&x);
i=1;
while((sum<2.6)&&(prod<=1.5))
{
prod=prod*(x/i);
If(prod<=1.5)
sum=sum+prod;
if(sum>2.5)
42
43