qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmrtyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjkl
B.TECH IT FIRST SEMESTER
GE6161 COMPUTER PRORAMMING
MANUAL REGULATION 2013
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
2
Ex.No:1 DOCUMENT CREATION, TEXT MANIPULATION
WITH SCIENTIFIC NOTATIONS
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:
Justify the Text.
Make some of the text as Bold type.
Correct the spellings.
Underline and make Italic style for some words.
Save the document with a suitable name.
Add the bullets and numbering using the format menu.
Change the line spacing as 1.5 for the whole text in a document.
Place a box to the Entire text.
2. Try out the following equations in your document:
Ca(HCO3)2 CaCo3 + Co2 + H2O
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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
3
Select any one WordArt Style and insert in the document.
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 CHARTS LINE, XY, BAR and PIE AND 3D
VIEW OF THE CHARTS
Aim
To create charts like Line, XY, Bar and Pie in Microsoft Excel editor.
Procedure
An Example,
Sales Report for the first quarter 2011
A B C D E
1 Vehicle Jan Feb Mar Total
2 Car 250 300 310
3 Auto 54 92 20
4 Jeep 91 120 11
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
4
5 Van 125 119 78
6 Total
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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
5
Right click the above figure, and select the 3D view to get the
3D view of the above Pie chart.
3D view of the 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 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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
6
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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
7
Car Auto Jeep Van Total
Jan
Mar0
50
100
150
200
250
300
350
total
Vehicle
Month
3D view of the column chart
Jan
Feb
Mar
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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
8
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.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
9
5. Type the following data in column F
F
1. Cost
2. 200000
3. 700000
4. 900000
5. 1000000
Draw an XY graph comparing two numerical variables viz., cost of the
vehicle andsale of the vehicle.
Enter the above data in the worksheet
Select the Total and Cost columns from the worksheet
Choose Chart from the Insert menu
Choose the Chart type: XY(Scatter) and then select the desired chart
sub-type from the samples on display. Click on the Next button.
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
10
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
11
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.
The terminator symbol marks the starting or ending point of the
system. It It usually contains the word Strat or End.
hdhfjhjsdh A box can represent a single step or an entire sub-process within a larger
process. process
A printed document or report.
Start/End
Action or Process
Document
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
12
A decision or branching point. Lines representing different decisions
emerge fr emerge from different points of the diamond.
Represents material or information entering or leavithe system.
Indicates that the flow continues on another page, where a matching
symbol has symbol has been placed (containing the same letter).
Flow Lines indicate the sequence of steps and the direction of flow.
Result:
Decision
Input/ Output
Connector
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
13
1. Operators & Expressions
Ex.No.4A MENU DRIVEN CALCULATOR USING SWITCH CASE
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
#include
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");
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
14
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
15
Step 5: End of program
Program
#include
#include
void main()
{
int product,n,i;
clrscr();
printf("\n enter the no. of table");
scanf("%d",&n);
printf("the result is \n");
for( i=1;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
16
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
#include
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();
}
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
17
OUTPUT:
Enter the number: 121
The number is a palindrome
Enter the number: 134
The number is not a palindrome
Result:
Ex.No.5A PRIME NUMBER OR NOT
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
18
}
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 GENERATING FIBONACCI SERIES
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
19
getch();
}
OUTPUT:
Enter the number : 7
The fibannoci series is
0 1 1 2 3 5 8
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]
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
20
max=a[0]; min=a[0];
}
for(i=1;imax)
{
max=a[i];
}
if(a[i]
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
21
Step 4: Enter for loops by checking the conditions i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
22
{
if(num[i]
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
23
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
#include
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
24
printf("\nElements of A matrix:");
for(i=0;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
25
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
#include
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
26
for(j=0;j
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
27
}
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:
1 2 3
4 5 6
7 8 9
Elements of B matrix:
9 8 7
6 5 4
3 2 1
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
28
Program
#include
#include
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
29
Result:
Ex.No.7B STRING MANUIPULATION WITHOUT USING LIBRARY
FUNCTIONS - STRING COMPARISON
Aim
To compare the two given strings without using library functions
Algorithm
Step 1: Start the program
Step 2: Read name1[10], name2[10] and initialize i=0
Step 3: Check the condition name[i] = name[2] and name1[i] !=\0
Step 4: If the condition is true increment i by 1 and then if name1[i] =
name2[i], print given two strings are equal
Step 5: Then if the above condition is false, print given two strings are not
equal
Step 6: End of program
Program
#include
#include
void main()
{
int i;
char str1[20],str2[20];
clrscr();
printf(Enter the first and second string:);
scanf(%s%s,str1,str2);
for(i=1;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
30
printf(The both string is equal);
else
printf(The both string is not equal);
getch();
}
}
Output 1
Enter the first and second string: divya divya
The both string is equal
Output 2
Enter the first and second string: divya malli
The both string is not equal
Result:
Ex.No.7C SORTING THE NAMES IN ALPHABETICAL ORDER
AIM
To Write a C program to sort the names in alphabetical order using string
function.
ALGORITHM
1. Start the program.
2. Enter number of names.
3. Enter the names.
4. Set two loops and compare every two strings.
5. If strcmp function return greater than zero value then swap two
strings. Using strcpy function and use temporary variable.
6. Repeat step 5 until all the strings are compared.
7. Stop the program.
PROGRAM:
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
31
#include
#include
#include
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
32
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
33
{
int i,n,a[10];
clrscr();
printf("Enter the no of elements:");
scanf("%d",&n);
for(i=0;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
34
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
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
35
printf("enter the elements:");
for(i=1;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
36
Ex.No.9 FACTORIAL OF A NUMBER IN RECURSIVE METHOD
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
#include
void main()
{
long int factorial(int );
int n;
long int fact;
clrscr();
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
37
printf("Enter the number:");
scanf("%d",&n);
fact=factorial(n);
printf("Factorial of is %d is %ld \n",n,fact);
getch();
}
long int factorial(int x)
{
long int fact;
if(x==0)
return 1;
else
fact=x*factorial(x-1);
return fact;
}
OUTPUT:
Enter the number:5
Factorial of 5 is 20
Result:
6. Structures and Union
Ex.No.10A PRINTING MARKSHEETS OF n STUDENTS
USING STRUCTURES
Aim
To print the mark sheet of n students using structures
Algorithm
Step 1: Start the program
Step 2: Initiate structure student with char name[25] and integer physics,
chemistry, mathematics and total
Step 3: Read the number of student
Step 4: Read name, physics, chemistry, mathematics marks using for loop
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
38
Step 5: Print the name, physics, chemistry, mathematics marks
Step 6: Obtain the total by adding physics, chemistry and mathematics
marks
Step 7: Print the total marks
Program:
#include
#include
struct student
{
char name[10],grade;
int rollno,m1,m2,m3,total;
float avg;
};
void main()
{
int n,i,j;
struct student s1[10];
clrscr();
printf("Enter the number of students:");
scanf("%d",&n);
printf("Enter student number,name,and 3 subjects marks....\n");
for(i=1;i
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
39
else if(s1[i].avg
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
40
Enter the Mark2:56
Enter the Mark3:75
The details of the marklist is as follows:
Roll no Name Mark1 Mark2 Mark3 Total
35 Priya 45 98 78 221
36 Asha 98 56 75 239
Result:
Ex.No.10B PROGRAM TO FIND SIZE OF UNION AND NUMBER
OF BYTES RESERVED FOR IT
Aim:
To find size of union and number of bytes reserved for it
Algorithm:
Step1: start the program
Step 2: initialize the union and structure name
Step 3: print size of the union and structure
Program:
#include
void main()
{
union result
{
int marks;
char grade;
};
struct res
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
41
{
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:
Ex.No.10C PROGRAM TO PRINT THE VALUES USING UNION
Aim:
To print the values using union
Algorithm:
Step 1: start the program
Step 2: initialize the union
Step 3: read the variables a and b
Step 4: print the values of a and b
Step 5: stop
Program:
#include
#include
union name
{
int a;
char b[2];
};
main()
{
union name c;
c.a=256;
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
42
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:
Ex No.11 PROGRAM TO FIND THE SUM OF SERIES
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
#include
main( )
{ float x,sum=0,prod=1;
int i; clrscr( ); printf(enter x value);
scanf(%f,&x); i=1;
while((sum
cseitquestions.blogspot.in | cseitquestions.blogspot.in | cseitquestions.blogspot.in
43
{
sum=sum-prod;
Break;
}
printf(sum=%f,sum); I++;
} getch();
}