SlideShare a Scribd company logo
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 1 of 25 BPOPS Lab Programs
PRINCIPLES OF PROGRAMMING
USING C LABORATORY [ BPOPS203]
by:
Dr. A. Syed Mustafa
Prof. Madhusudhana
DEPARTMENT OF INFORMATION SCIENCE
AND ENGINEERING
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 2 of 25 BPOPS Lab Programs
HKBK COLLEGE OF E
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 3 of 25 BPOPS Lab Programs
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 4 of 25 BPOPS Lab Programs
1. Simulation of a Simple Calculator.
/*Simulation of a Simple Calculator*/
#include <stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
char op;
printf("Simple Calculatorn");
printf("Enter the Expressionn");
scanf("%d%c%d",&a,&op,&b); /* read input eg. 2+3 */
switch(op)
{
case '+': c=a+b; /*add 2 numbers*/
break;
case '-': c=a-b; /*subtract 2 numbers*/
break;
case '*': c=a*b; /*multiply 2 numbers*/
break;
case '/': c=a/b; /*divide 2 numbers*/
break;
case '%': c=a%b; /*find reminder of 2 numbers*/
break;
default: printf("Invalid Expressionn");
}
printf("%dn",c); /* display result*/
getch();
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 5 of 25 BPOPS Lab Programs
2. Compute the roots of a quadratic equation by accepting the coefficients. Print
appropriate messages.
#include <stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d;
float r,r1,r2;
printf("Enter the Coefficients a,b and cn");
scanf("%d%d%d",&a,&b,&c); /* read input - ax^2+bx+c */
if(a*b*c==0)
{
printf("Please enter non zero valuesn");
getch();
exit(0);
} /*end if*/
d=b*b-4*a*c;
r=2*a;
if(d==0)
{
printf("Roots are Real and Equaln");
r1=r2=-b/r;
printf("Root 1: %.2f, Root 2: %.2fn",r1,r2);
}
else if(d>0)
{
printf("Roots are Real and Distinctn");
r1=(-b+sqrt(d))/r;
r2=(-b-sqrt(d))/r;
printf("Root 1: %.2f, Root 2: %.2fn",r1,r2);
}
else
{
printf("Roots are Imaginaryn");
r1=-b/r;
r2=sqrt(-d)/r;
printf("Root 1: %.2f+i%.2f, Root 2: %.2f-i%.2fn",r1,r2,r1,r2);
} /*end else*/
getch();
}/* end main*/
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 6 of 25 BPOPS Lab Programs
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 7 of 25 BPOPS Lab Programs
3. An electricity board charges the following rates for the use of electricity: for the first 200
units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units Rs 1
per unit. All users are charged a minimum of Rs.100 as meter charge. If the total amount
is more than Rs 400, then an additional surcharge of 15% of total amount is charged.
Write a program to read the name of the user, number of units consumed and print out
the charges.
#include <stdio.h>
#include<conio.h>
void main()
{
int n,mc=100;
float bill;
char name[50];
printf("Enter the Name of the Usern");
scanf("%s",name);
printf("Enter the number of units electricity consumedn");
scanf("%d",&n);
if(n<=200)
bill=n*0.8;
else if(n<=300)
bill=160+(n-200)*0.9;
else if(n>300)
bill=250+(n-300)*1;
bill=bill+mc; /* meter charge added with bill*/
if(bill>400)
bill=bill+bill*0.15;
printf("Consumer Name: %sn",name);
printf("No. of Units Consumed: %dn",n);
printf("Total Bill Amount Rs. %.2fn",bill);
getch();
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 8 of 25 BPOPS Lab Programs
4.
#include <stdio.h>
#include<conio.h>
void main()
{
int n,i,j,k,m;
printf("nEnter the value of n:n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++) /*print spaces*/
printf(" ");
for(k=1; k<=i ; k++) /*print increment numbers*/
printf("%d ",k);
for(m=i-1; m>0; m--) /*print decrement numbers*/
printf("%d ",m);
printf("n");
} /*end for*/
getch();
}/* end main*/
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 9 of 25 BPOPS Lab Programs
5. Implement Binary Search on Integers.
#include <stdio.h>
#include<conio.h>
void main()
{
int a[100],n,s,e,mid,key,f=0,i;
printf("nEnter the total no. of elements:n");
scanf("%d",&n);
printf("nEnter the elements in ascending ordern");
for(i = 0 ; i < n ; i++) /*read all elements*/
scanf("%d",&a[i]);
printf("nEnter the element to be searched:n");
scanf("%d",&key);
s=0; /*start index*/
e=n-1; /*ending index*/
while(s<=e)
{
mid=(s+e)/2; /*middle index*/
if(key==a[mid]) /* comparing key value with middle value*/
{
f=1;
break;
}
if(key>a[mid])
s=mid+1;
else
e=mid-1;
} /* end while*/
if(f)
printf("Search Successfuln");
else
printf("Search UnSuccessfuln");
getch();
}/* end main*/
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 10 of 25 BPOPS Lab Programs
6. Implement Matrix multiplication and validate the rules of multiplication.
#include <stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10];
int m,n,p,q,i,j,k;
printf("nEnter the order of the matrix A:n");
scanf("%d%d",&m,&n);
printf("nEnter the order of the matrix B :n");
scanf("%d%d",&p,&q);
if(n!=p) /*comparing colmof Matrix A with row of Matrix B*/
{
printf("Matrix Multiplication is not possiblen");
getch();
exit(0);
} /* end if*/
printf("nEnter the elements of matrix An");
for(i = 0 ; i < m ; i++)
for(j = 0 ; j < n ; j++)
scanf("%d",&a[i][j]);
printf("nEnter the elements of matrix Bn");
for(i = 0 ; i < p ; i++)
for(j = 0 ; j < q ; j++)
scanf("%d",&b[i][j]);
for(i = 0 ; i < m ; i++)
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];
}/*end for j loop*/
printf("nMATRIX A n");
for(i = 0 ; i < m ; i++)
{
for(j = 0 ; j < n ; j++)
printf("%dt", a[i][j]);
printf("n");
}/*end for i loop*/
printf("nMATRIX B n");
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 11 of 25 BPOPS Lab Programs
for(i = 0 ; i < p ; i++)
{
for(j = 0 ; j < q ; j++)
printf("%dt", b[i][j]);
printf("n");
}/*end for i loop*/
printf("nResultant MATRIXn");
for(i = 0 ; i < m ; i++)
{
for(j = 0 ; j < q ; j++)
printf("%dt", c[i][j]);
printf("n");
} /*end for i loop*/
getch();
}/* end main*/
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 12 of 25 BPOPS Lab Programs
7. Compute sin(x)/cos(x) using Taylor series approximation. Compare your result with the
built-in library function. Print both the results with appropriate inferences.
/*Program to compute Sin(x) using Taylor series approximation given by Sin(x) = x -(x3/3!) +
(x5/5!) - (x7/7!) + ....... Compare the result with the built- in Library function and print both the
results.*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,degree;
float x,sum=0,term,nume,deno;
printf("Enter the value of degree:");
scanf("%d",&degree);
x=degree*(3.142/180);/* converting degree to radian*/
nume=x;
deno=1;
i=2;
do
{
term=nume/deno;
nume=-nume*x*x; /*multiply by x twice*/
deno=deno*i*(i+1); /* multiply by next and next value*/
sum=sum+term;
i=i+2;
}while(fabs(term)>=0.00001); /*check float absolute to 0.00001*/
printf("the sine of %d is %.2fn",degree,sum);
printf("the sine function of %d is %.2f:",degree,sin(x));
getch();
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 13 of 25 BPOPS Lab Programs
8. Sort the given set of N numbers using Bubble sort.
#include <stdio.h>
#include<conio.h>
void main()
{
int n,i,j,a[100],temp;
printf("nEnter the total no. of elements:n");
scanf("%d",&n);
printf("nEnter the elementsn");
for(i = 0 ; i < n ; i++) /*read all elements*/
scanf("%d",&a[i]);
for(i = 0 ; i < n-1; i++)
for(j = 0 ; j < n-i-1; j++)
if(a[j] > a[j+1]) /*compare next 2 numbers*/
{
temp = a[j]; /*swap 2 numbers*/
a[j] = a[j+1];
a[j+1] = temp;
}
printf("nThe Sorted elements aren");
for(i = 0 ; i < n ; i++) /* display all elements*/
printf("%dn",a[i]);
getch();
}/* end main*/
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 14 of 25 BPOPS Lab Programs
9. Write functions to implement string operations such as compare, concatenate, and find
string length. Use the parameter passing techniques.
#include<stdio.h> /* string length, concate , compare*/
#include<conio.h>
int slength(char s[])
{
int i;
for(i=0;s[i]!=0;i++);
return (i);
} /*end slength*/
void concat(char s1[100],char s2[100])
{
int len,i;
len=slength(s1);
for(i=0;s2[i]!=0;i++)
s1[len+i]=s2[i];
s1[len+i]=0;
}/*end concate*/
void compare(char s1[100],char s2[100])
{
int l1,l2,i;
l1=slength(s1);
l2=slength(s2);
if(l1!=l2)
printf("Strings are not equaln");
else
{
for(i=0;i<l1;i++)
if(s1[i]>s2[i])
{
printf("String %s is greater than string %s1n",s1,s2);
return;
}/*end if*/
else if(s1[i]<s2[i])
{
printf("String %s is smaller than string %s1n",s1,s2);
return;
}/* else if*/
printf("String %s is equal with string %sn",s1,s2);
}/* else*/
}/* end compare*/
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 15 of 25 BPOPS Lab Programs
void main()
{
char s1[100],s2[100];
int len;
printf("Enter the first stringn");
gets(s1);
printf("Enter the second stringn");
gets(s2);
len=slength(s1);
printf("Length of '%s' is %dn",s1,len);
compare(s1,s2);
concat(s1,s2);
printf("concatenated string is %sn", s1);
getch();
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 16 of 25 BPOPS Lab Programs
10. Implement structures to read, write and compute average- marks of the students, list the
students scoring above and below the average marks for a class of N students.
#include<stdio.h>
typedef struct /* defining structure*/
{
int rollno;
char name[50];
float marks;
}student;
void main()
{
int n,i;
float sum=0,avg;
student s[50]; /* declaring 50 students*/
printf("Enter the total no of studentsn");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the student: %d datails:n",i+1);
printf("Enter the student Rollno:");
scanf("%d",&s[i].rollno);
printf("Enter the student Name:");
scanf("%s",s[i].name);
printf("Enter the marks:");
scanf("%f",&s[i].marks);
sum=sum+s[i].marks;
}
avg=sum/n;
printf("Student details:n");
printf("RollnotNametMarksn");
for(i=0;i<n;i++)
{
printf("%dt",s[i].rollno);
printf("%st",s[i].name);
printf("%.2fn",s[i].marks);
}
printf("Average marks is %.2fn",avg);
printf("Below average Students details:n");
printf("RollnotNametMarksn");
for(i=0;i<n;i++)
{
if(s[i].marks<avg)
{
printf("%dt",s[i].rollno);
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 17 of 25 BPOPS Lab Programs
printf("%st",s[i].name);
printf("%.2fn",s[i].marks);
} /* end if*/
} /* end for*/
printf("Above average Students details:n");
printf("RollnotNametMarksn");
for(i=0;i<n;i++)
{
if(s[i].marks>avg)
{
printf("%dt",s[i].rollno);
printf("%st",s[i].name);
printf("%.2fn",s[i].marks);
} /* end if*/
} /* end for*/
getch();
} /* end main*/
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 18 of 25 BPOPS Lab Programs
11. Develop a program using pointers to compute the sum, mean and standard deviation of
all elements stored in an array of N real numbers.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a[10],*ptr,mean,std,sum=0,sumstd=0;
int n,i;
printf("Enter the total numbersn");
scanf("%d",&n);
printf("Enter the real numbersn");
for(i=0;i<n;i++)
scanf("%f",&a[i]); /* Reading Input Of N Numbers*/
ptr=a; /*assigning address of array to pointer variable*/
for(i=0;i<n;i++)
sum=sum + *ptr++; /* adding real numbers stored in array through pointer*/
mean=sum/n; /* finding average or mean*/
ptr=a; /*assigning address of array to pointer variable*/
for(i=0;i<n;i++)
{
sumstd=sumstd+pow((*ptr-mean),2); /*finding standard deviation*/
ptr++; /* incrementing pointer to fetch next value*/
}
std=sqrt(sumstd/n); /*finding standard deviation*/
printf("sum=%.2fn",sum);
printf("Mean=%.2fn",mean);
printf("standard deviation=%.2fn",std);
getch( );
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 19 of 25 BPOPS Lab Programs
12. Write a C program to copy a text file to another, read both the input file name and
target file name.
#include<stdio.h>
#include<conio.h>
void main()
{
char ch, fname1[50], fname2[50];
FILE *f1, *f2;
printf("Enter the file name to copy its content(source file)n");
scanf("%s",fname1);
printf("Enter the file name to write the copied content(target file)n");
scanf("%s",fname2);
f1= fopen(fname1, "r");
if (fname1 == NULL)
{
printf("Can not read filen");
exit(0);
}
f2 = fopen(fname2, "w");
if (fname2== NULL)
{
fclose(f1);
printf("Can not write to filen");
exit(0);
}
while ((ch = fgetc(f1)) != EOF)
fputc(ch, f2);
printf("File copied successfullyn");
fclose(f1);
fclose(f2);
getch( );
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 20 of 25 BPOPS Lab Programs
Additional Programs
1. Write a C program to compute addition, subtraction, multiplication and division on
Complex Numbers.
#include<stdio.h>
struct complex
{
float rp;
float ip;
};
typedef struct complex COMP;
COMP readcomplex()
{
COMP c;
printf("Enter the details of Complex number:n");
scanf("%f%f",&c.rp,&c.ip);
return(c);
}
COMP addcomplex(COMP c1,COMP c2)
{
COMP c3;
c3.rp=c1.rp+c2.rp;
c3.ip=c1.ip+c2.ip;
return c3;
}
COMP subcomplex(COMP c1,COMP c2)
{
COMP c4;
c4.rp=c1.rp-c2.rp;
c4.ip=c1.ip-c2.ip;
return c4;
}
COMP multicomplex(COMP c1,COMP c2)
{
COMP c5;
c5.rp=c1.rp*c2.rp-c1.ip*c2.ip;
c5.ip=c1.rp*c2.ip+c1.ip*c2.rp;
return c5;
}
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 21 of 25 BPOPS Lab Programs
COMP dividecomplex(COMP c1,COMP c2)
{
COMP c6;
c6.rp=(c1.rp*c2.rp+c1.ip*c2.ip)/(c2.rp*c2.rp+c2.ip*c2.ip);
c6.ip=(c2.rp*c1.ip-c2.ip*c1.rp)/(c2.rp*c2.rp+c2.ip*c2.ip);
return c6;
}
void displaycomplex(COMP c)
{
if(c.ip<0)
printf("%.2f%.2fin",c.rp,c.ip);
else
printf("%.2f+%.2fin",c.rp,c.ip);
}
int main()
{
struct complex c1,c2,c3,c4,c5,c6;
c1=readcomplex();
c2=readcomplex();
c3=addcomplex(c1,c2);
c4=subcomplex(c1,c2);
c5=multicomplex(c1,c2);
c6=dividecomplex(c1,c2);
printf("Complex number 1 is:n");
displaycomplex(c1);
printf("Complex number 2 is:n");
displaycomplex(c2);
printf("Complex number addition is:n");
displaycomplex(c3);
printf("Complex number subtraction is:n");
displaycomplex(c4);
printf("Complex number multiplication is:n");
displaycomplex(c5);
printf("Complex number division is:n");
displaycomplex(c6);
return(0);
}
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 22 of 25 BPOPS Lab Programs
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 23 of 25 BPOPS Lab Programs
2. Write a C program to compute Electricity Bill
#include<stdio.h>
typedef struct
{
long telno;
char cname[50];
int units;
float bill;
}Tbill;
int main()
{
Tbill t1;
int fc=250;
printf("Enter the Telephone numbern");
scanf("%d",&t1.telno);
printf("Enter the consumer namen");
scanf("%s",t1.cname);
printf("Enter the no of units usedn");
scanf("%d",&t1.units);
if(t1.units<=50)
t1.bill=t1.units*1;
else
t1.bill=t1.units*1.5;
t1.bill=fc+t1.bill;
printf("Telephone Bill Details:n");
printf("Telephone no: %ldn",t1.telno);
printf("conusmer Name: %sn",t1.cname);
printf("No of units used: %dn",t1.units);
printf("Bill Amount: %.2fn",t1.bill);
return 0;
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 24 of 25 BPOPS Lab Programs
3. Write a C program to convert a string of characters to upper case/lower case.
#include<stdio.h>
#include<string.h>
void main()
{
char s1[100],s2[100];
int len,i;
printf("Enter the first stringn");
gets(s1);
for(i=0;s1[i]!=0;i++) /* getting each char from s1*/
if(s1[i]>='A' && s1[i]<='Z')
s2[i]=s1[i]+32; /* convering to lowercase*/
else if(s1[i]>='a' && s1[i]<='z')
s2[i]=s1[i]-32; /* convering to uppercase*/
else
s2[i]=s1[i]; /*copying other than alpha character to s1 at last*/
s2[i]=0; /* adding null value to string*/
printf("string in upper lower case is %sn",s2);
getch();
}
OUTPUT:
`
PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
Dr. A. Syed Mustafa, HKBKCE. Page 25 of 25 BPOPS Lab Programs
4. Write a C program to check whether a string is palindrome or not.
#include<stdio.h> /* srtring palindrome*/
void main()
{
char s[100];
int len,i,p=1;
printf("Enter the stringn");
scanf("%s",s);
for(i=0;s[i]!=0;i++);
len=i;
for(i=0;i<len/2;i++)
if(s[i]!=s[len-1-i])
{
p=0;
break;
}
if(p)
printf("string %s is palaindromen",s);
else
printf("string %s is not a palaindromen",s);
getch();
}
OUTPUT:

More Related Content

What's hot

Web Technology Lab files with practical
Web Technology Lab  files with practicalWeb Technology Lab  files with practical
Web Technology Lab files with practical
Nitesh Dubey
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical File
Harjinder Singh
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentation
Prionto Abdullah
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
Hussain Buksh
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
C programming
C programmingC programming
C programming
Jigarthacker
 
C basics
C   basicsC   basics
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in CJeya Lakshmi
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
Ahmad Idrees
 
Getting started with arduino uno
Getting started with arduino unoGetting started with arduino uno
Getting started with arduino uno
Saumya Ranjan Behura
 
Overview of c++ language
Overview of c++ language   Overview of c++ language
Overview of c++ language
samt7
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
Tarun Sharma
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
Rumman Ansari
 
Programming in c
Programming in cProgramming in c
Programming in c
indra Kishor
 
OCP Java SE 8 Exam - Sample Questions - Java Streams API
OCP Java SE 8 Exam - Sample Questions - Java Streams APIOCP Java SE 8 Exam - Sample Questions - Java Streams API
OCP Java SE 8 Exam - Sample Questions - Java Streams API
Ganesh Samarthyam
 

What's hot (20)

Loops in c
Loops in cLoops in c
Loops in c
 
Web Technology Lab files with practical
Web Technology Lab  files with practicalWeb Technology Lab  files with practical
Web Technology Lab files with practical
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical File
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
 
Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentation
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
C programming
C programmingC programming
C programming
 
C basics
C   basicsC   basics
C basics
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
File operations in c
File operations in cFile operations in c
File operations in c
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Getting started with arduino uno
Getting started with arduino unoGetting started with arduino uno
Getting started with arduino uno
 
Overview of c++ language
Overview of c++ language   Overview of c++ language
Overview of c++ language
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
 
Programming in c
Programming in cProgramming in c
Programming in c
 
OCP Java SE 8 Exam - Sample Questions - Java Streams API
OCP Java SE 8 Exam - Sample Questions - Java Streams APIOCP Java SE 8 Exam - Sample Questions - Java Streams API
OCP Java SE 8 Exam - Sample Questions - Java Streams API
 

Similar to BPOPS203 PRINCIPLES OF PROGRAMMING USING C LAB Manual.pdf

Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
Syed Mustafa
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
Eelco Visser
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
janakim15
 
Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]
Vivek Kumar Sinha
 
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax DefinitionCompiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Eelco Visser
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
Prof. Dr. K. Adisesha
 
Pslb lab manual
Pslb lab manualPslb lab manual
Pslb lab manual
Vivek Kumar Sinha
 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
THE NORTHCAP UNIVERSITY
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
AkhilaaReddy
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3alish sha
 
c programing
c programingc programing
c programing
bibek lamichhane
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
Harleen Sodhi
 
Opps manual final copy
Opps manual final   copyOpps manual final   copy
Opps manual final copy
moorthy muppidathi
 
OOPs manual final copy
OOPs manual final   copyOOPs manual final   copy
OOPs manual final copy
moorthy muppidathi
 

Similar to BPOPS203 PRINCIPLES OF PROGRAMMING USING C LAB Manual.pdf (20)

C PROGRAMS
C PROGRAMSC PROGRAMS
C PROGRAMS
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
 
Data struture lab
Data struture labData struture lab
Data struture lab
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
 
Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]
 
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax DefinitionCompiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax Definition
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
Pslb lab manual
Pslb lab manualPslb lab manual
Pslb lab manual
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
 
week-3x
week-3xweek-3x
week-3x
 
c programing
c programingc programing
c programing
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
 
Opps manual final copy
Opps manual final   copyOpps manual final   copy
Opps manual final copy
 
OOPs manual final copy
OOPs manual final   copyOOPs manual final   copy
OOPs manual final copy
 

More from Syed Mustafa

18CSL58 DBMS LAB Manual.pdf
18CSL58 DBMS LAB Manual.pdf18CSL58 DBMS LAB Manual.pdf
18CSL58 DBMS LAB Manual.pdf
Syed Mustafa
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
Syed Mustafa
 
IoT - module 4
IoT - module 4IoT - module 4
IoT - module 4
Syed Mustafa
 
15CS81- IoT- VTU- module 3
15CS81- IoT- VTU- module 315CS81- IoT- VTU- module 3
15CS81- IoT- VTU- module 3
Syed Mustafa
 
15CS81- IoT Module-2
15CS81- IoT Module-215CS81- IoT Module-2
15CS81- IoT Module-2
Syed Mustafa
 
Internet of Things - module 1
Internet of Things -  module 1Internet of Things -  module 1
Internet of Things - module 1
Syed Mustafa
 
15CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 115CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 1
Syed Mustafa
 
15CS664- Python Application Programming VTU syllabus
15CS664- Python Application Programming  VTU syllabus15CS664- Python Application Programming  VTU syllabus
15CS664- Python Application Programming VTU syllabus
Syed Mustafa
 
15CS664- Python Application Programming - Module 3
15CS664- Python Application Programming - Module 315CS664- Python Application Programming - Module 3
15CS664- Python Application Programming - Module 3
Syed Mustafa
 
15CS664-Python Application Programming - Module 3 and 4
15CS664-Python Application Programming - Module 3 and 415CS664-Python Application Programming - Module 3 and 4
15CS664-Python Application Programming - Module 3 and 4
Syed Mustafa
 
15CS664 Python Question Bank-3
15CS664 Python Question Bank-315CS664 Python Question Bank-3
15CS664 Python Question Bank-3
Syed Mustafa
 
Usp notes unit6-8
Usp notes unit6-8Usp notes unit6-8
Usp notes unit6-8
Syed Mustafa
 
Grid computing notes
Grid computing notesGrid computing notes
Grid computing notes
Syed Mustafa
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
Syed Mustafa
 
answer-model-qp-15-pcd13pcd
answer-model-qp-15-pcd13pcdanswer-model-qp-15-pcd13pcd
answer-model-qp-15-pcd13pcd
Syed Mustafa
 
VTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in CVTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in C
Syed Mustafa
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
Syed Mustafa
 
Data structures lab c programs
Data structures lab  c programsData structures lab  c programs
Data structures lab c programs
Syed Mustafa
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversion
Syed Mustafa
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
Syed Mustafa
 

More from Syed Mustafa (20)

18CSL58 DBMS LAB Manual.pdf
18CSL58 DBMS LAB Manual.pdf18CSL58 DBMS LAB Manual.pdf
18CSL58 DBMS LAB Manual.pdf
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
IoT - module 4
IoT - module 4IoT - module 4
IoT - module 4
 
15CS81- IoT- VTU- module 3
15CS81- IoT- VTU- module 315CS81- IoT- VTU- module 3
15CS81- IoT- VTU- module 3
 
15CS81- IoT Module-2
15CS81- IoT Module-215CS81- IoT Module-2
15CS81- IoT Module-2
 
Internet of Things - module 1
Internet of Things -  module 1Internet of Things -  module 1
Internet of Things - module 1
 
15CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 115CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 1
 
15CS664- Python Application Programming VTU syllabus
15CS664- Python Application Programming  VTU syllabus15CS664- Python Application Programming  VTU syllabus
15CS664- Python Application Programming VTU syllabus
 
15CS664- Python Application Programming - Module 3
15CS664- Python Application Programming - Module 315CS664- Python Application Programming - Module 3
15CS664- Python Application Programming - Module 3
 
15CS664-Python Application Programming - Module 3 and 4
15CS664-Python Application Programming - Module 3 and 415CS664-Python Application Programming - Module 3 and 4
15CS664-Python Application Programming - Module 3 and 4
 
15CS664 Python Question Bank-3
15CS664 Python Question Bank-315CS664 Python Question Bank-3
15CS664 Python Question Bank-3
 
Usp notes unit6-8
Usp notes unit6-8Usp notes unit6-8
Usp notes unit6-8
 
Grid computing notes
Grid computing notesGrid computing notes
Grid computing notes
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
 
answer-model-qp-15-pcd13pcd
answer-model-qp-15-pcd13pcdanswer-model-qp-15-pcd13pcd
answer-model-qp-15-pcd13pcd
 
VTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in CVTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in C
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
 
Data structures lab c programs
Data structures lab  c programsData structures lab  c programs
Data structures lab c programs
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversion
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 

Recently uploaded

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 

BPOPS203 PRINCIPLES OF PROGRAMMING USING C LAB Manual.pdf

  • 1. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 1 of 25 BPOPS Lab Programs PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203] by: Dr. A. Syed Mustafa Prof. Madhusudhana DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING
  • 2. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 2 of 25 BPOPS Lab Programs HKBK COLLEGE OF E
  • 3. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 3 of 25 BPOPS Lab Programs PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ]
  • 4. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 4 of 25 BPOPS Lab Programs 1. Simulation of a Simple Calculator. /*Simulation of a Simple Calculator*/ #include <stdio.h> #include<conio.h> void main() { int a,b,c; char op; printf("Simple Calculatorn"); printf("Enter the Expressionn"); scanf("%d%c%d",&a,&op,&b); /* read input eg. 2+3 */ switch(op) { case '+': c=a+b; /*add 2 numbers*/ break; case '-': c=a-b; /*subtract 2 numbers*/ break; case '*': c=a*b; /*multiply 2 numbers*/ break; case '/': c=a/b; /*divide 2 numbers*/ break; case '%': c=a%b; /*find reminder of 2 numbers*/ break; default: printf("Invalid Expressionn"); } printf("%dn",c); /* display result*/ getch(); } OUTPUT:
  • 5. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 5 of 25 BPOPS Lab Programs 2. Compute the roots of a quadratic equation by accepting the coefficients. Print appropriate messages. #include <stdio.h> #include<conio.h> void main() { int a,b,c,d; float r,r1,r2; printf("Enter the Coefficients a,b and cn"); scanf("%d%d%d",&a,&b,&c); /* read input - ax^2+bx+c */ if(a*b*c==0) { printf("Please enter non zero valuesn"); getch(); exit(0); } /*end if*/ d=b*b-4*a*c; r=2*a; if(d==0) { printf("Roots are Real and Equaln"); r1=r2=-b/r; printf("Root 1: %.2f, Root 2: %.2fn",r1,r2); } else if(d>0) { printf("Roots are Real and Distinctn"); r1=(-b+sqrt(d))/r; r2=(-b-sqrt(d))/r; printf("Root 1: %.2f, Root 2: %.2fn",r1,r2); } else { printf("Roots are Imaginaryn"); r1=-b/r; r2=sqrt(-d)/r; printf("Root 1: %.2f+i%.2f, Root 2: %.2f-i%.2fn",r1,r2,r1,r2); } /*end else*/ getch(); }/* end main*/
  • 6. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 6 of 25 BPOPS Lab Programs OUTPUT:
  • 7. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 7 of 25 BPOPS Lab Programs 3. An electricity board charges the following rates for the use of electricity: for the first 200 units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units Rs 1 per unit. All users are charged a minimum of Rs.100 as meter charge. If the total amount is more than Rs 400, then an additional surcharge of 15% of total amount is charged. Write a program to read the name of the user, number of units consumed and print out the charges. #include <stdio.h> #include<conio.h> void main() { int n,mc=100; float bill; char name[50]; printf("Enter the Name of the Usern"); scanf("%s",name); printf("Enter the number of units electricity consumedn"); scanf("%d",&n); if(n<=200) bill=n*0.8; else if(n<=300) bill=160+(n-200)*0.9; else if(n>300) bill=250+(n-300)*1; bill=bill+mc; /* meter charge added with bill*/ if(bill>400) bill=bill+bill*0.15; printf("Consumer Name: %sn",name); printf("No. of Units Consumed: %dn",n); printf("Total Bill Amount Rs. %.2fn",bill); getch(); } OUTPUT:
  • 8. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 8 of 25 BPOPS Lab Programs 4. #include <stdio.h> #include<conio.h> void main() { int n,i,j,k,m; printf("nEnter the value of n:n"); scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=n-i;j++) /*print spaces*/ printf(" "); for(k=1; k<=i ; k++) /*print increment numbers*/ printf("%d ",k); for(m=i-1; m>0; m--) /*print decrement numbers*/ printf("%d ",m); printf("n"); } /*end for*/ getch(); }/* end main*/ OUTPUT:
  • 9. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 9 of 25 BPOPS Lab Programs 5. Implement Binary Search on Integers. #include <stdio.h> #include<conio.h> void main() { int a[100],n,s,e,mid,key,f=0,i; printf("nEnter the total no. of elements:n"); scanf("%d",&n); printf("nEnter the elements in ascending ordern"); for(i = 0 ; i < n ; i++) /*read all elements*/ scanf("%d",&a[i]); printf("nEnter the element to be searched:n"); scanf("%d",&key); s=0; /*start index*/ e=n-1; /*ending index*/ while(s<=e) { mid=(s+e)/2; /*middle index*/ if(key==a[mid]) /* comparing key value with middle value*/ { f=1; break; } if(key>a[mid]) s=mid+1; else e=mid-1; } /* end while*/ if(f) printf("Search Successfuln"); else printf("Search UnSuccessfuln"); getch(); }/* end main*/ OUTPUT:
  • 10. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 10 of 25 BPOPS Lab Programs 6. Implement Matrix multiplication and validate the rules of multiplication. #include <stdio.h> #include<conio.h> void main() { int a[10][10],b[10][10],c[10][10]; int m,n,p,q,i,j,k; printf("nEnter the order of the matrix A:n"); scanf("%d%d",&m,&n); printf("nEnter the order of the matrix B :n"); scanf("%d%d",&p,&q); if(n!=p) /*comparing colmof Matrix A with row of Matrix B*/ { printf("Matrix Multiplication is not possiblen"); getch(); exit(0); } /* end if*/ printf("nEnter the elements of matrix An"); for(i = 0 ; i < m ; i++) for(j = 0 ; j < n ; j++) scanf("%d",&a[i][j]); printf("nEnter the elements of matrix Bn"); for(i = 0 ; i < p ; i++) for(j = 0 ; j < q ; j++) scanf("%d",&b[i][j]); for(i = 0 ; i < m ; i++) 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]; }/*end for j loop*/ printf("nMATRIX A n"); for(i = 0 ; i < m ; i++) { for(j = 0 ; j < n ; j++) printf("%dt", a[i][j]); printf("n"); }/*end for i loop*/ printf("nMATRIX B n");
  • 11. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 11 of 25 BPOPS Lab Programs for(i = 0 ; i < p ; i++) { for(j = 0 ; j < q ; j++) printf("%dt", b[i][j]); printf("n"); }/*end for i loop*/ printf("nResultant MATRIXn"); for(i = 0 ; i < m ; i++) { for(j = 0 ; j < q ; j++) printf("%dt", c[i][j]); printf("n"); } /*end for i loop*/ getch(); }/* end main*/ OUTPUT:
  • 12. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 12 of 25 BPOPS Lab Programs 7. Compute sin(x)/cos(x) using Taylor series approximation. Compare your result with the built-in library function. Print both the results with appropriate inferences. /*Program to compute Sin(x) using Taylor series approximation given by Sin(x) = x -(x3/3!) + (x5/5!) - (x7/7!) + ....... Compare the result with the built- in Library function and print both the results.*/ #include<stdio.h> #include<conio.h> #include<math.h> void main() { int i,degree; float x,sum=0,term,nume,deno; printf("Enter the value of degree:"); scanf("%d",&degree); x=degree*(3.142/180);/* converting degree to radian*/ nume=x; deno=1; i=2; do { term=nume/deno; nume=-nume*x*x; /*multiply by x twice*/ deno=deno*i*(i+1); /* multiply by next and next value*/ sum=sum+term; i=i+2; }while(fabs(term)>=0.00001); /*check float absolute to 0.00001*/ printf("the sine of %d is %.2fn",degree,sum); printf("the sine function of %d is %.2f:",degree,sin(x)); getch(); } OUTPUT:
  • 13. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 13 of 25 BPOPS Lab Programs 8. Sort the given set of N numbers using Bubble sort. #include <stdio.h> #include<conio.h> void main() { int n,i,j,a[100],temp; printf("nEnter the total no. of elements:n"); scanf("%d",&n); printf("nEnter the elementsn"); for(i = 0 ; i < n ; i++) /*read all elements*/ scanf("%d",&a[i]); for(i = 0 ; i < n-1; i++) for(j = 0 ; j < n-i-1; j++) if(a[j] > a[j+1]) /*compare next 2 numbers*/ { temp = a[j]; /*swap 2 numbers*/ a[j] = a[j+1]; a[j+1] = temp; } printf("nThe Sorted elements aren"); for(i = 0 ; i < n ; i++) /* display all elements*/ printf("%dn",a[i]); getch(); }/* end main*/ OUTPUT:
  • 14. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 14 of 25 BPOPS Lab Programs 9. Write functions to implement string operations such as compare, concatenate, and find string length. Use the parameter passing techniques. #include<stdio.h> /* string length, concate , compare*/ #include<conio.h> int slength(char s[]) { int i; for(i=0;s[i]!=0;i++); return (i); } /*end slength*/ void concat(char s1[100],char s2[100]) { int len,i; len=slength(s1); for(i=0;s2[i]!=0;i++) s1[len+i]=s2[i]; s1[len+i]=0; }/*end concate*/ void compare(char s1[100],char s2[100]) { int l1,l2,i; l1=slength(s1); l2=slength(s2); if(l1!=l2) printf("Strings are not equaln"); else { for(i=0;i<l1;i++) if(s1[i]>s2[i]) { printf("String %s is greater than string %s1n",s1,s2); return; }/*end if*/ else if(s1[i]<s2[i]) { printf("String %s is smaller than string %s1n",s1,s2); return; }/* else if*/ printf("String %s is equal with string %sn",s1,s2); }/* else*/ }/* end compare*/
  • 15. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 15 of 25 BPOPS Lab Programs void main() { char s1[100],s2[100]; int len; printf("Enter the first stringn"); gets(s1); printf("Enter the second stringn"); gets(s2); len=slength(s1); printf("Length of '%s' is %dn",s1,len); compare(s1,s2); concat(s1,s2); printf("concatenated string is %sn", s1); getch(); } OUTPUT:
  • 16. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 16 of 25 BPOPS Lab Programs 10. Implement structures to read, write and compute average- marks of the students, list the students scoring above and below the average marks for a class of N students. #include<stdio.h> typedef struct /* defining structure*/ { int rollno; char name[50]; float marks; }student; void main() { int n,i; float sum=0,avg; student s[50]; /* declaring 50 students*/ printf("Enter the total no of studentsn"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Enter the student: %d datails:n",i+1); printf("Enter the student Rollno:"); scanf("%d",&s[i].rollno); printf("Enter the student Name:"); scanf("%s",s[i].name); printf("Enter the marks:"); scanf("%f",&s[i].marks); sum=sum+s[i].marks; } avg=sum/n; printf("Student details:n"); printf("RollnotNametMarksn"); for(i=0;i<n;i++) { printf("%dt",s[i].rollno); printf("%st",s[i].name); printf("%.2fn",s[i].marks); } printf("Average marks is %.2fn",avg); printf("Below average Students details:n"); printf("RollnotNametMarksn"); for(i=0;i<n;i++) { if(s[i].marks<avg) { printf("%dt",s[i].rollno);
  • 17. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 17 of 25 BPOPS Lab Programs printf("%st",s[i].name); printf("%.2fn",s[i].marks); } /* end if*/ } /* end for*/ printf("Above average Students details:n"); printf("RollnotNametMarksn"); for(i=0;i<n;i++) { if(s[i].marks>avg) { printf("%dt",s[i].rollno); printf("%st",s[i].name); printf("%.2fn",s[i].marks); } /* end if*/ } /* end for*/ getch(); } /* end main*/ OUTPUT:
  • 18. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 18 of 25 BPOPS Lab Programs 11. Develop a program using pointers to compute the sum, mean and standard deviation of all elements stored in an array of N real numbers. #include<stdio.h> #include<conio.h> #include<math.h> void main() { float a[10],*ptr,mean,std,sum=0,sumstd=0; int n,i; printf("Enter the total numbersn"); scanf("%d",&n); printf("Enter the real numbersn"); for(i=0;i<n;i++) scanf("%f",&a[i]); /* Reading Input Of N Numbers*/ ptr=a; /*assigning address of array to pointer variable*/ for(i=0;i<n;i++) sum=sum + *ptr++; /* adding real numbers stored in array through pointer*/ mean=sum/n; /* finding average or mean*/ ptr=a; /*assigning address of array to pointer variable*/ for(i=0;i<n;i++) { sumstd=sumstd+pow((*ptr-mean),2); /*finding standard deviation*/ ptr++; /* incrementing pointer to fetch next value*/ } std=sqrt(sumstd/n); /*finding standard deviation*/ printf("sum=%.2fn",sum); printf("Mean=%.2fn",mean); printf("standard deviation=%.2fn",std); getch( ); } OUTPUT:
  • 19. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 19 of 25 BPOPS Lab Programs 12. Write a C program to copy a text file to another, read both the input file name and target file name. #include<stdio.h> #include<conio.h> void main() { char ch, fname1[50], fname2[50]; FILE *f1, *f2; printf("Enter the file name to copy its content(source file)n"); scanf("%s",fname1); printf("Enter the file name to write the copied content(target file)n"); scanf("%s",fname2); f1= fopen(fname1, "r"); if (fname1 == NULL) { printf("Can not read filen"); exit(0); } f2 = fopen(fname2, "w"); if (fname2== NULL) { fclose(f1); printf("Can not write to filen"); exit(0); } while ((ch = fgetc(f1)) != EOF) fputc(ch, f2); printf("File copied successfullyn"); fclose(f1); fclose(f2); getch( ); } OUTPUT:
  • 20. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 20 of 25 BPOPS Lab Programs Additional Programs 1. Write a C program to compute addition, subtraction, multiplication and division on Complex Numbers. #include<stdio.h> struct complex { float rp; float ip; }; typedef struct complex COMP; COMP readcomplex() { COMP c; printf("Enter the details of Complex number:n"); scanf("%f%f",&c.rp,&c.ip); return(c); } COMP addcomplex(COMP c1,COMP c2) { COMP c3; c3.rp=c1.rp+c2.rp; c3.ip=c1.ip+c2.ip; return c3; } COMP subcomplex(COMP c1,COMP c2) { COMP c4; c4.rp=c1.rp-c2.rp; c4.ip=c1.ip-c2.ip; return c4; } COMP multicomplex(COMP c1,COMP c2) { COMP c5; c5.rp=c1.rp*c2.rp-c1.ip*c2.ip; c5.ip=c1.rp*c2.ip+c1.ip*c2.rp; return c5; }
  • 21. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 21 of 25 BPOPS Lab Programs COMP dividecomplex(COMP c1,COMP c2) { COMP c6; c6.rp=(c1.rp*c2.rp+c1.ip*c2.ip)/(c2.rp*c2.rp+c2.ip*c2.ip); c6.ip=(c2.rp*c1.ip-c2.ip*c1.rp)/(c2.rp*c2.rp+c2.ip*c2.ip); return c6; } void displaycomplex(COMP c) { if(c.ip<0) printf("%.2f%.2fin",c.rp,c.ip); else printf("%.2f+%.2fin",c.rp,c.ip); } int main() { struct complex c1,c2,c3,c4,c5,c6; c1=readcomplex(); c2=readcomplex(); c3=addcomplex(c1,c2); c4=subcomplex(c1,c2); c5=multicomplex(c1,c2); c6=dividecomplex(c1,c2); printf("Complex number 1 is:n"); displaycomplex(c1); printf("Complex number 2 is:n"); displaycomplex(c2); printf("Complex number addition is:n"); displaycomplex(c3); printf("Complex number subtraction is:n"); displaycomplex(c4); printf("Complex number multiplication is:n"); displaycomplex(c5); printf("Complex number division is:n"); displaycomplex(c6); return(0); }
  • 22. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 22 of 25 BPOPS Lab Programs OUTPUT:
  • 23. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 23 of 25 BPOPS Lab Programs 2. Write a C program to compute Electricity Bill #include<stdio.h> typedef struct { long telno; char cname[50]; int units; float bill; }Tbill; int main() { Tbill t1; int fc=250; printf("Enter the Telephone numbern"); scanf("%d",&t1.telno); printf("Enter the consumer namen"); scanf("%s",t1.cname); printf("Enter the no of units usedn"); scanf("%d",&t1.units); if(t1.units<=50) t1.bill=t1.units*1; else t1.bill=t1.units*1.5; t1.bill=fc+t1.bill; printf("Telephone Bill Details:n"); printf("Telephone no: %ldn",t1.telno); printf("conusmer Name: %sn",t1.cname); printf("No of units used: %dn",t1.units); printf("Bill Amount: %.2fn",t1.bill); return 0; } OUTPUT:
  • 24. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 24 of 25 BPOPS Lab Programs 3. Write a C program to convert a string of characters to upper case/lower case. #include<stdio.h> #include<string.h> void main() { char s1[100],s2[100]; int len,i; printf("Enter the first stringn"); gets(s1); for(i=0;s1[i]!=0;i++) /* getting each char from s1*/ if(s1[i]>='A' && s1[i]<='Z') s2[i]=s1[i]+32; /* convering to lowercase*/ else if(s1[i]>='a' && s1[i]<='z') s2[i]=s1[i]-32; /* convering to uppercase*/ else s2[i]=s1[i]; /*copying other than alpha character to s1 at last*/ s2[i]=0; /* adding null value to string*/ printf("string in upper lower case is %sn",s2); getch(); } OUTPUT:
  • 25. ` PRINCIPLES OF PROGRAMMING USING C LABORATORY [ BPOPS203 ] Dr. A. Syed Mustafa, HKBKCE. Page 25 of 25 BPOPS Lab Programs 4. Write a C program to check whether a string is palindrome or not. #include<stdio.h> /* srtring palindrome*/ void main() { char s[100]; int len,i,p=1; printf("Enter the stringn"); scanf("%s",s); for(i=0;s[i]!=0;i++); len=i; for(i=0;i<len/2;i++) if(s[i]!=s[len-1-i]) { p=0; break; } if(p) printf("string %s is palaindromen",s); else printf("string %s is not a palaindromen",s); getch(); } OUTPUT: