C Manual New
C Manual New
C Manual New
MANUAL-#
MANUAL-#
LAB-01
Q-1;
#include<iostream>
using namespace std;
#include<conio.h>
{
int main()
// (A) using one statement with one stream insertion
operator.
cout<<"1\t2\t3\t4\t5\t6\n";
//(B)using N statements
cout<<"\t1";
cout<<"\t2";
cout<<"\t3";
cout<<"\t4";
cout<<"\t5";
cout<<"\t6";
cout<<"\t7\n";
getch();
return o;
}
Q-2:
2 BS-CS---DEPARTMENT OF COMPUTER SCIENCE
SUKKUR INSTITUTE OF BUSINESS ADMINISTRATION
MANUAL-#
#include<iostream>
using namespace std;
#include<conio.h>
{
int main()
getch();
return 0;
}
Q-3:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"\n********** * *";
cout<<"\n* * *** * * ";
cout<<"\n* * ***** * * ";
cout<<"\n* * * * *";
cout<<"\n* * * * * ";
cout<<"\n* * * * * ";
cout<<"\n* * * * * ";
cout<<"\n* * * * * " ;
cout<<"\n* * * * * " ;
cout<<"\n********** * * ";
getch();}
LAB-2
3 BS-CS---DEPARTMENT OF COMPUTER SCIENCE
SUKKUR INSTITUTE OF BUSINESS ADMINISTRATION
MANUAL-#
Q-1:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a,b,c,d,sum,r;
cout<<"enter numerator for 1st fraction:";
cin>>a;
cout<<"enter denominator for 1st fraction:";
cin>>b;
cout<<"enter numerator for 2nd fraction:";
cin>>c;
cout<<"enter denominator for 2nd fraction:";
cin>>d;
sum=(a*d)+(b*c);
r=b*d;
cout<<"sum is:"<<sum<<" / "<<r;
getch();
return 0;
}
Q-2:
#include<conio.h>
using namespace std;
#include<iostream>
void main()
{
Int t;
cout<<”enter number for table=”;
cin>>t;
cout<<”table of”<<t<<”\n”;
cout<<t<<”*1=\t”<<t*1<<”\n”;
cout<<t<<”*2=\t”<<t*2<<”\n”;
cout<<t<<”*3=\t”<<t*3<<”\n”;
cout<<t<<”*4=\t”<<t*4<<”\n”;
MANUAL-#
cout<<t<<”*5=\t”<<t*5<<”\n”;
cout<<t<<”*6=\t”<<t*6<<”\n”;
cout<<t<<”*7=\t”<<t*7<<”\n”;
cout<<t<<”*8=\t”<<t*8<<”\n”;
cout<<t<<”*9=\t”<<t*9<<”\n”;
cout<<t<<”*10=\t”<<t*10<<”\n”;
getch();
}
Q----3:
#include<iostream>
using namespace std;
#include<conio.h>
void main()
{
int d,n;
cout<<"enter deviser:";
cin>>d;
cout<<"enter an integer:";
cin>>n;
if(n%d==0)
MANUAL-#
else
LAB—3
Q---1:
6 BS-CS---DEPARTMENT OF COMPUTER SCIENCE
SUKKUR INSTITUTE OF BUSINESS ADMINISTRATION
MANUAL-#
Q---2:
#include<iostream.h>
MANUAL-#
#include<conio.h>
void main()
{
clrscr();
int x,y;
cout<<"enter the value of x:";
cin>>x;
cin>>y;
else
if(x!=y)//checks an other condition
else
else
if(x<y) //checks an other condition
getch();
MANUAL-#
Q---3;
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
MANUAL-#
if(marks>90)//checks condition
if(marks==100)//checks condition
MANUAL-#
if(marks<90)//checks condition
getch();//get character
} //end of program
LAB---4
Q-1:-
11 BS-CS---DEPARTMENT OF COMPUTER SCIENCE
SUKKUR INSTITUTE OF BUSINESS ADMINISTRATION
MANUAL-#
cin>>fac;
Else
if(fac>=11) //cecks condition
if(fac<=15) //This statment verify that factor value is less
than or equal to 15
{
cout<<"\nValue of Pressure is "<<(pre=45); //It will print
45 for values between 11 to 15
}
MANUAL-#
else
if (fac>20) //Its an condition that if other Values Enters
as value of factor those are greater than 20
{
Q-2:-
//This program is made by RAHMAN ALI from BS-2(Computer Science)
THP
MANUAL-#
p=res+earn;
cout<<"tour total earning per week is"<<p;
}
getch();
return 0; }
LAB---5
MANUAL-#
Q-1:
/* this program is created by RAHMAN ALI for finding the size of
variable which it consumes in the memory*/
#include<conio.h>
#include<iostream.h>
void main() // main function calling
{ // start of program
int a; // declaration of variable
cout<<sizeof(a); // finding the size of varible by using
size of.
Q—2:-
#include<conio.h>
#include<iostream.h>
void main ()
{
clrscr();
int a=2,b=3, result;//declare variables
float x=3.0,y;
y=a*b;//perform the operation of multiplication
cout<<"\n "<<y;//display result in integer
result=a*b;
cout<<"\n "<<result;//display result in integer
y=a/b;
cout<<"\n "<<y;//display result in integer
15 BS-CS---DEPARTMENT OF COMPUTER SCIENCE
SUKKUR INSTITUTE OF BUSINESS ADMINISTRATION
MANUAL-#
y=a/b*x;
cout<<"\n "<<y;//display result in integer
y=a*x/b;
cout<<"\n "<<y;//display result in integer
result=a*x/b
cout<<"\n"<<result;//display result in integer
getch();
}
Q—3:
#include<iostream>
using namespace std;
#include<conio.h>
{
system("color b");
{
min=hr*60;//because 1 hour is equal to 60 min
else
MANUAL-#
Q---4:-
#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
float gallon;//declare variable
cout<<"enter the value in gallon:";//prompt user to enter
gallons
cin>> gallon;//takes input from user
cout<<gallon<<"gallons are equal to"<<gallon*7.481<<"cubic
feet";//display result
getch();
}