Feed Headline Animator

Briefly describe the basic structure of C program

Basic structure of C program: -
The logic according to witch a program is written is called the structure of the program. The structure of basic C program consists of two main parts. These are:
. Preprocessor Directives
. The main ( ) function
The structure of a C language program will be as:
Main ( )
{
Declaration phase
Input phase
Processing phase
Output phase
}
Every program of C language must be given and to save program with extension .C with its name. It is the name which is given to our work when we save it permanently in computer.
The symbol dot (.) one, two or three character are given differentiate or to specify the name of file with respect to its program.


Posted by: Wasim Javed

Programming languages

A computer programs is written in a specific manner and according to a set of rules. These rules are called the computer language. It is also interface between computer and user.

Posted by: Wasim Javed

language, computer language and compiler

Language: -
It is an interface between the people like Urdu, English etc.

Computer language: - It is also an interface between computer and user.

Compiler: - This translator or converter program is used to convert a program in to machine language but as a whole.

Posted by: Wasim Javed

English medium education

English medium education

An English medium education system is one that uses English as the primary medium of instruction. A medium of instruction is the language that is used in teaching. The language used may or may not be the official language of the territory. Most schools and institutions of education in modern-day mainly English-speaking countries such as the UK, United States, Ireland, Australia and New Zealand use English as the medium of instruction.

Because a working knowledge of English is perceived as being required in many fields, professions, and occupations, many states throughout the world mandate the teaching of English, at least a basic level, in an effort to increase the competitiveness of their economies.

The language researcher David Graddol predicts that the global spread of English will lead to serious economic and political disadvantages in the future in the UK unless plans are put in place immediately to remedy the situation. Graddol concludes that monolingual English graduates face a bleak economic future as qualified multilingual young people from other countries are proving to have a competitive advantage over their British counterparts in global companies and organisations.

Historical background

English medium education has long been associated with the expansion of English from its homeland in England and the lowlands of Scotland and its spread to the rest of Great Britain and Ireland.

The influence of the British Empire is the primary reason for the language's initial spread far beyond the United Kingdom. Following World War II, the increased economic and cultural influence of the United States led to English permeating many other cultures, chiefly through development of telecommunications technology.

English linguistic imperialism as "the dominance asserted and maintained by the establishment and continuous reconstitution of structural and cultural inequalities between English and other languages."

Phillipson's theory provides a powerful critique on the historical spread of English as an international language and how it continues to maintain its current dominance particularly in postcolonial contexts like India but also increasingly in "neo-colonial" contexts such as continental Europe. His theory draws mainly on Johan Galtung's imperialism theory, Antonio Gramsci's social theory and in particular his notion of cultural hegemony.

The Islamic Republic of Pakistan

The Government of Pakistan has recently announced the introduction of English lessons on a phased basis to all schools across the country. This new policy states that "English language has been made compulsory from Class-1 onwards" and the "Introduction of English as medium of instruction for science, mathematics, computer science and other selected subjects like economics and geography in all schools in a graduated manner." Caretaker Minister for Education Mr. Shujaat Ali Beg declared January 25, 2008 that eighteen colleges of the city of Karachi would be made "Model English Medium Colleges,"

Posted by: Wasim Javed

Course Outline for B.Sc Physics Paper B

PAPER B TH: 30, PRACTICAL: 15(Only one Practical with Both Papers A and B)

Paper-B

{Waves and Oscillation}

Main Topics
Harmonic Oscillations


Simple harmonic oscillation
(SHM)


(Obtaining and solving the basic equations of motion x (t), v (t), and a (t). Energy)

Consideration in S.H.M

Application of SHM

(Torsional oscillation, Physical pendulum, Simple pendulum)

SHM and uniform
Circular motion,
Combination of Harmonic
Motion


(Lissaajous patterns)

Damped Harmonic
Motion


(Equation of damped harmonic motion, Discussion of its solution)

Forced Oscillation
And Resonance


(Equation of forced oscillation, Discussion of its solutions, Examples of resonance)

Waves

Mechanical waves
Traveling waves


(Phase velocity of traveling waves, Sinusoidal waves, Group speed and dispersion)

Waves speed

(Mechanical analysis)

Wave equation

(Discussion of solution)

Power and intensity
In waves motion

(Derivation & Discussion)

Principle of superposition
(Basic Ideas)


(Interference of waves, Standing waves, Phase changes on reflection, Natural frequency, Resonance)

Sound

Beats phenomenon

(Analytical treatment)



Doppler Effect

(Moving source, Moving observer, both object and source moving)

Light

Nature of light

(Visible light {Physical characteristics})

Light as an electromagnetic
Wave


(Speed of light in matter, Physical aspects, Path difference, Phase difference etc)

Interference

Adding of electromagnetic
Waves using phasors


(Coherence of sources, double slit interference, Analytical treatment)

Interference from films

(Newton’s ring {Analytical treatment})

Michelson interferometer


(Discussion to include use of a compensating plates, Michelson interferometer use in determining velocity of light)

Fresnel’s biprism and its use

Diffraction


(Diffraction at single slit, Intensity in single slit diffraction using phasor treatment and analytical treatment using addition of waves, Double slit interference & diffraction combined, Diffraction at a circular aperture)

Diffraction from
Multiple slits


(Discussion to include width of the maxima)

Diffraction grating

(Discussion, Use in spectrographs, Dispersion and resolving power of gratings)

Holography

(Qualitative discussion)

Polarization


(Basic definition, production of polarization
By polarizing sheets, by reflection, by double refraction and double scattering)

Description of
Polarization states


(Linear, Circular, elliptic polarization)

Rotation of plane
Of polarization


(Use of Polari meter)


Thermodynamics
And Statistical
Mechanics


Temperature, Kinetic
Theory of the ideal gas,
Work done on an ideal
Gas


(Review of previous concepts)

Internal energy of
And ideal gas


(To include the Equipartation of energy)

Intermolecular forces
Qualitative discussion


(Vander Waals equation of state)

Statistical
Mechanics


Statistical Distribution
And mean values

(Mean free path and microscopic Calculations of mean free path)

Distribution of molecular
Speeds, Distribution of
Energies


(Maxwell distribution, Maxwell
Boltzmann energy distribution, internal
Energy of an ideal gas)


Brownian motion

(Qualitative description, Definition, Conduction and

Thermodynamics
And Statistical
Mechanics



Temperature, Kinetic
Theory of The ideal gas,
Work done on an ideal
Gas


(Review of previous concepts)

Internal energy of and
Ideal gas


(To include the Equipartation of energy)

Intermolecular forces
Qualitative discussion


(Vander Waals equation of state)

Statistical Mechanics

Statistical Distribution
And mean values


(Mean free path and microscopic Calculations of mean free path)

Distribution of molecular
Speeds, Distribution of
Energies



(Maxwell distribution, Maxwell
Boltzmann energy distribution, internal
Energy of an ideal gas)

Brownian motion

(Qualitative description, Definition, Conduction and
Viscosity)



Heat

Review of previous
Concepts, First law
Of thermodynamics,
Transfer of heat


(First law of thermodynamics & its application to adiabatic, isothermal, cyclic and free expansion)


Entropy &
Second law Of
Thermodynamics

Reversible an irreversible
Processes, Second law
Carnot cycle, Carnot
Engines


(Definition, discussion, Heat engine,
Refrigerators & Second Law, Calculation of Efficiency of heat engines)


Posted by: Wasim Javed

Course Outline for B.Sc Physics Paper A

PAPER A TH: 30, PRACTICAL: 15(Only one Practical with Both Papers A and B)

Paper-A

{Mechanics}

Main Topics

Vector Operations:

Vector in 3 dimensions

(Introduction, Direction of cosines, Spherical polar coordinates, Applications)

Vector Derivatives and
Operations


(Divergence and curl of a vector, Gradient of a scalar)

Gradient, Divergence
And curl of a vector


(Physical applications of each types, Divergence and flux of a vector field, Curl and line integral {Mutal Relation}

Divergence Theorem

(Derivation, Physical importance and applications to specific cases, converting from differential to integral forms)

Stokes Theorem

(Derivation, Physical importance and applications to specific cases, converting from differential to integral forms)

Particle Dynamics

Advanced applications
Of Newton’s Law


(Electrical forces, Microscopic basis of this force)

Dynamic of uniform
Motion


(Conical pendulum, the rotor, Circular the banked curve)

Equation of motion

(Deriving kinematics questions X {V}, V {T} using integrations, Constant and non constant, Forces and special examples)

Time dependent forces

(Obtaining X {T}, V {T} for this case using integration method)

Effect of drag forces
On motion


(Applying Newton’s law to obtain V {T} for the case of motion with time dependent drag {Viscous} forces, Terminal velocity, Projectile motion / air resistance)

Non inertial frames
And pseudo forces


(Qualitative discussion to develop understanding, Calculation of pseudo forces for simple cases {linearly accelerated references frame}, Centrifugal forces as an example of pseudo forces, Carioles forces)

Limitations of Newton’s
Law discussion


Work and Energy

Work done by a constant
Forces, Work done by a


Variable force {1 Dimensional}

(Essentially a review of grade-XII concepts use of integration technique to calculate work done, {e.g. in vibration of a spring obeying Hooke’s law}

Work done by a variable
{2 Dimensional cases}


(Obtaining general expression force and applying to simple cases e.g. pulling a mass at the end of a fixed sting against gravity)

Work energy theorem.
General proof of work
Energy theorem


(Qualitative review of work energy theorem, Derivation using integral calculus, Basic formula, Applications)

Power

Reference frame

(Energy changes with respect to observers in different inertial frames)


Conservation of energy

Conservative, None
Conservative forces


(Definition of either type of force & examples, Work done in a closed path)

(1-D conservative system, Force as the gradient of potential energy, Application to the case a spring and force of gravity)

1 dimensional
Conservative system


(Obtaining velocity in the terms of U and E, Stable, Unstable and neutral equilibrium, Analytic solution for X {T})

2, 3 dimensional
Conservative system


(Change in P.E, for motion in 3-d, Force as the gradient of the potentials, Work done in 2, 3dimensional motion)

Conservation of energy
In a system of particles


(Law of conservation of total energy of an isolated system)

System of Particles

Two particle systems
And generalization to
Many particle systems


(Centre of mass, its position velocity and equation of motion)

Centre of mass of
Solid objects


(Calculation of centre of mass of solid objects using integral calculus, Calculating C.M of
1. Uniform rod
2. Cylinder
3. Sphere

Momentum changes
In a system of variables
Mass


(Derivation of basic equations, Application to motion of a racket {Determination of its mass as a function of time})

Collision

Elastic collision:

Conservation of
Momentum during collision


(a) One dimension
(b) Two dimension {oblique collision}

Inelastic collision,
Collision in centre
Of mass reference frame


(One and two dimensions, Simple application, Obtaining velocities in C.M frame)


Rotational Dynamic

Overview of rotational
Dynamics


(Relation ship between linear & angular variables, Scalar vector form, Kinetic energy of rotation, Moment of inertia)

Parallel axis theorem

(Prove and illustration, Apply simple mass)

Determination of moment
Of inertia of various shapes,
Rotational dynamic of rigid
Bodies


(Equation of rotational motion and effects of application of torques)

Combine rotational
And transnational motion


(Rolling without slipping)

Angular Momentum

Angular velocity


(Definition, Conversion of angular momentum, Effect of torque)

Stability of spinning
Objects


(Discussion with example)

The spinning top

(Effects of torque on the angular momentum, Processional motion)

Gravitation

Review of basic concepts
Of gravitation, Gravitational
Effect of a spherical mass
Distribution


(Mathematical treatment)


Gravitational potential
Energy


(Develop using integration techniques, Calculation of escape velocity)

Gravitational field &
Potential


(Develop the idea of field of force)

Universal gravitational
Law


(Motion of planets and Keplers law {Derivation & Explanation} Motion of satellites, Energy considerations in planetary and satellite motion, Qualitative discussion on application of gravitational law to the galaxy)

Bulk Properties of
Matters


Elastic properties of matter

(Physical basis of elasticity tension, Compression & shearing, elastic modulus, Elastic limit)

Fluid Statics

(Variation of pressure in fluid at rest and with height in the atmosphere)

Surface tension

(Physical basis, Role in formation of drop and bubbles)

Fluid Dynamics

(General concept of fluid flow streamline and the torque of continuity)

Bernoulli’s Equation

(Derivation and some applications such as dynamic lift thrust on a rocket)

Viscosity

(Physical basis, obtaining the coefficient of viscosity, Practical example of viscosity, Fluid flow through a cylindrical pipe {poisenille’s law})

Special Theory of Relativity

Trouble with classical
Mechanics


(Qualitative discussion of the inadequacy or paradoxes in classical ideas of time, Length, and velocity)

Postulates of relativity

(Statements and discussion)

The Lorentz transformation
Inverse transformation


(Derivation, Assumption on which derived, Application of the same transformation of velocities)

Consequences of Lorentz
Transformation


(Relativity of time, Relativity of length)

Relativity momentum

(Derivation)

Relativistic energy



(Derive E=mc2), {E=mc Square}


Posted by: Wasim Javed

The array of 5 element in the main function and call a function to sort the given the array and the sorted list will be displayed in the main function

Main()
{
int n[5],I;
for(i=0;i<=4;i++)
{
printf(“Enter the number\n”);
scanf(“%d”,&n[i]);
}
sorting(n[0]);
printf(“The sorted list\n”);
for(i=0;i<=4;i++)
printf(“%d\n”,n[i]);
getch();
}
sorting (int *k)
{
int I,j,t;
for(i=0;i<4;i++)
for(j=i+1 ;j<=4 ;j++)
if(*(k+i)>* (k+j ))
{
t=*(k+I );
*(k+i)=*(k+j);
*(k+j )=t;
}
}


Posted by: Wasim Javed

Problem 6

main()
{
int l[10] ,I ,j, s;
for(i=0; < 10 ;i++)
{
printf(“Enter a number \n”);
scanf(“%d”,&l[i]);
s= summation (&l[0]);
printf(“sum=%d\n”,s);
}
summation (int *p)
{
int j,sum=0;
for(i=0 ;j<10 ;j++)
sum +=*(p+j);
return( sum);
}


Posted by: Wasim Javed

Problem 5

main()
{
int n,m,c;
printf(“Enter two number \n”);
scanf( “%d %d “,&n, &m);
c=addition (&n, &m);
printf(sum of sequres =%d”,c);
}
addition ( int* p1 ,int *p2)
{
intr ;
r=* p1 *p2 +p2 *p2;
return ( r);
}


Posted by: Wasim Javed

Palindrome

main()
{
char ch [10];
int I, l;
printf(“Enter string \n”);
gets ( ch);
l= strlen (ch);
printf(“In reverse order \n”);
for( i=l; i>=0; i- -)
printf(“%c\n”,ch [i]);
}
Declare pointer of pointer
Example
Main()
{int x=20;
int *px;
px =&x;
print{“%d”,*px);
}
Proto typing
Int *a ,b ,c;
B=10;
A=&b;
C=*a;

Pointer to function
Example
Main()
{
int display ( );
func-ptr =display ;
printf(“address of function display is %, fun-ptr”);
}
int display ( )
{
puts (“Wasim javed \n”);
}
Swap Function
(1) Function swap(int a, int b);
{
int temp;
temp =a;
a =b;
b= temp;
}
(2) function swap (int*a, int*bb);
{
int temp;
temp =*a;
*a =*b;
*b = temp;
}


Posted by: Wasim Javed

Problem 4

Main()
{
char source [ ] = “folks”, target[30] =”Hello”;
strcat( target ,source)
printf(source =%s\n”, source );
printf(“target =%s \n”,target);
}


Posted by: Wasim Javed

Problem 3

Main()
{
char source [ ] =”Hello”;
char target [20];
strcpy (target , source);
printf(%s %s “, source , target );
}


Posted by: Wasim Javed

Problem 2

Main()
{
char arr[ ] =”Wasim”
int l 1, l2;
l 1=strlen (arr);
l 2=strlen(Hello How are you\n”);
printf(“string =%s length =%d\n”,arr ,[1);
printf(“string =%s length =%d\n”, Hello How are you ,l 2);
}


Posted by: Wasim Javed

Problem 1

Main()
{
char arr[ ] =”Wasim”
int l 1, l2;
l 1=strlen (arr);
l 2=strlen(Hello How are you\n”);
printf(“string =%s length =%d\n”,arr ,[1);
printf(“string =%s length =%d\n”, Hello How are you ,l 2);
}


Posted by: Wasim Javed

To remove a specified character.

Main()
{
char s[80];
int p;
printf(“Type string and position to removed \n”);
gets ( s );
scanf(“%d”,&p);
strcpy (&s[p], &[p+1] );
puts (s);
}


Posted by: Wasim Javed

WAP to read a sentence and print all lower case to upper case and upper case to lower case.

Main()
{
char s[32];
int I,l;
printf(“Enter Sentence\n”);
gets( s);
l=strlen( s);
for(i=0 ;i<= l;i++)
{
if (( s[i]>=’a’ && (s[i]<=’z’)
s[i]- =32;
s[i]+=32;
}
puts(s);
}


Posted by: Wasim Javed

WAP to read a sentence and count a specific letter (LOOP)

Main()
{
char s[30],ch;
int c,l,t=0;
printf(“Enter letter to counted\n”);
ch =getche();
l = strlen( s);
for(i=0 ;i<=l ;I ++)
{
if(s[i] = =c)
t++;
}
printf(“%c comes %d times “,ch ,t);
}


Posted by: Wasim Javed

Read a sentence and count vowel ,uppercase to lower case

main()
{
char s[20];
int v, l , u ,l g;
gets (s);
lg= strlen (s)
for (i=0; i<=lg ;i++)
{
if (s [i]>= ‘A’ && s[i]<= ‘Z’)
u++;
if( s[i]>=’a’ && s[i]<=’z’)
l++;
if (s [i] ==’a’)II s[i]==’z’) II( s[i] == ‘I’) II(s[i] ==’o’) II(s[i] = =’u’)
v++;
}
printf (“Total upper case letter = %d”, u);
printf(“Total lower case letter = %d”, u);
printf(“Total vowel case letter =%d “,u);
}


Posted by: Wasim Javed

Program

main()
{
char name[25];
printf” Enter your name\n”);
scanf(“Hello %s !”, name );
}


Posted by: Wasim Javed

Program to display a string

main()
{
char name[ ]=”Wasim javed “;
int l;
for(i=0 ;i<=7 ;i++)
printf (“%c”, name [i]);
}


Posted by: Wasim Javed

Sorting in Descending order

main()
{
int l[30],I, j, t;
for(i=1 ;i<=10;i++)
{
printf(Enter a number\n”);
scanf(“%d,&l[l]);
}
for(i=1 <10;i++)
if( j=l+;j<=10;j++)
if(l[i]>l[j=1])
{
t=l[i];
l[i]=l[i];
l[j+1]=t;
}
printf(sorted list\n”);
for(i=1 ;i<=10;j++)
printf(“%d\n”,l[i]);
}


Posted by: Wasim Javed

sorting in ascending order

main()
{
int l [30]; I; j;t;
for(i=l; i<=10; i++)
{
printf(“Enter a number \n”);
scanf(“%d”,&l[l]);
}
for(i=l; i<10; i++)
for(j=l+1; j<=10 ;j++)
if( l[l]>l[j])
{
t=l[i];
l[i]=l[i];
l[i]=t;
}
printf(“sorted list \n”);
for(i=1; i<=10; i++)
printf(“%d\n”,l[i]);
}


Posted by: Wasim Javed

Binary Search

main()
{
int a[10] ,f=0,l=0 ,loc=0, n,l,md;
printf(Enter the data in sorted order\n”);
for(l=0 ; l <10 ;l++)
{
printf((Enter no\n”);
scanf(“%d”,&a[l]);
printf(Enter no to be searched \n”);
scanf(“%d”,&n);
while(f{
mid=f+l)/2;
if(a[mid]==n);
{
loc=mid+1;
break;
}
if(a[mid]>n)
l=mid-1;
if(a[mid]f=mid+1;
}
jif(loc>=0);
printf(element is not found\n”);
else
printf(“element at location=%d\n”loc);
}


Posted by: Wasim Javed

Bubble sort

main()
{
int a[50],l,j,t,n;
pritnf(“Enter total element to be sorted\n”);
scanf(“%d”,&n);
for(l=0;l{
printf(“enter a number\n”);
scanf(“%d”,&a[l]);
}
for(l=0; lfor(j=0 ;jif(a[j]< a[a+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
printf(sorted list\n”);
for(l=0; lprintf(“%d\n”,a[j]);
getch();
}


Posted by: Wasim Javed

Example of linear or sequential search

main()
{
inta[10],sr,I,loc=0, f=0;
for(i=0, i<=10,i++)
{
printf(“Enter the number\n”);
scabf(“%d”,&a[i]);
}
printf(Enter the number to search\n”);
scanf(“%d”,&sr);
i=0;
while(i<10&&f==0)
{
if(sr==a[i])
{
f=1;
loc=i+1;
}
else
i++;
}
if(f==1)
printf(“Element is found at location=%d\n”,loc);
else
printf(Element is not found\n”);
getch();
}
}


Posted by: Wasim Javed

Sum of Dignal matrix

main()
{
int r,c sum=0 ,mat[3][3];
printf(“Enter first matrix\n”);
for(r=0; r<2; r++)
for(c=0; c<2; c++)
scanf(“%d”,&mat[r][c]);
for(r=0; r<2; r++)
{
printf(“%d/t”,mat[r][c]);
sum=sum+mat[r][c];
}
printf(“\n”);
printf(“Sum of matrix =%d\n”,sum);
getch();
}


Posted by: Wasim Javed

Multiplication of two matrix

main()
{
intr,c,k,n[3][3],m[3][3],res[3][3];
printf (Enter first matrix \n”);
for(r=0; r<3;r++);
for(c=0; c<3 ;c++);
scanf(“%d”,&n[r][c]);
printf(“Enter second matrix\n”);
for(r 0;r<3 ;r++);
for(c 0;c<3 ; c++);
scanf(“%d”,&m[r][c]);
for(r 0;r <3;r++);
for( c0; c<3; c++);
{
res[r][c]=0;
for(k=0 ;k<3 ;k++);
res[r][c]=res[r][c]+n[r][k]*m[k][c]);
}
printf(“Multiplication of matrix\n”);
for(r=0; r<3;r++)
{
for(c=0; c<3 ;c++)
printf(“%d/t”,res[r][c]);
printf(“\n”);
}
}


Posted by: Wasim Javed

Addition of two matrix

main()
{
int n[5][5], m[5][5],l ,j ,res[5][5];
printf(Enter first matrix\n”);
for(i=0<5;l++)
for(i=0; j<5; j++)
scanf(“%d”,&n[l][j]);
printf(“Enter second matrix\n”);
for(i=0 ;l< 5;l++)
for( j=0; j<5 ;j++)
res[l][j] =n[l][j] +m[l][j];
printf(“Resultant matrix\n”);
for(i=0 ;l<5 ;l++)
{
for(i=0; l<5 ;j++)
printf(“%d/t “,res [l][j]);
printf(“\n”);
getch();
}
}


Posted by: Wasim Javed

Sum of matrix

main()
{
int r,c sum =0, mat[3][3];
printf((“Enter first matrix\n”);for(r=0; r<2; r++);
for(c=0; c<2; c++)
{
printf(“%d/f”,mat[r][c]);
sum= sum+mat[r][c];
}
printf(“\n”);
printf(Sum of matrix =%d\n”,sum);
getch();
}
}


Posted by: Wasim Javed

Display the Largest number and position

main()
{
int l[10], lg, ps =1;
for(i=0 ;i<=9;i++)
{
printf(“Enter number\n”);
scanf(“%d”,&l[i] );
}
lg=l[1];
for(i=2; i<=9 ;i++);
}
if(lg{
if (lg=l[i];
ps= I;
}
printf(“largest No =%d/t\n”, lg);
printf(“position of numbers =%d\n”,ps);
getch();
}


Posted by: Wasim Javed

Display the smallest Number And Position

main()
{
int t[10],sam,I,p=0;
for(i=0;i<=9;i++);
{
printf(“Enter numbers\n”);
scanf(“%d”,&t[i]);
}
sam =t[10];
for(i=0;i<=9;i++);
{
if(sam>t[i] )
{
sam=t[i];
p=++I;
}
printf(“smallest = %d/t %d”,sam,p);
getch();
}


Posted by: Wasim Javed

Sum of ten numbers

main()
{
int a[10],sum =0,I;
float avg;
for (i=0<=9;i++);
{
printf(“Enter numbers\n”);
scanf(“%d”,&a[i]);
}
for (i=0,i<=9;i++);
sum +=a[i];
avg =aum/10;
printf(“Sum =%d”,sum);
printf(“average =%f”,avg);
getch();
}


Posted by: Wasim Javed

Display The List Of Numbers

main()
{
inta[10],I;
for(i=0;i<=9,i++)
{
printf(“Enter the number\n”);
scanf(“%d”,&a[i]);
}
printf(“The list of number \n”);
for(i=0<=9,i++)
{
printf(“%d\n”,a[i]);
}
}


Posted by: Wasim Javed

Write a program to perform simple arithmetic operation by using switch statement.

Main()
{
int a,b;
char opt;
clrscr();
printf(“Enter any two integer value\n”);
scanf(“%d %d “,&a, &b);
printf(“Enter your option for operation +,-, *, /n”);
scanf(“%c”,opt);
switch(opt)
{
case ‘+’;
printf(“\n\t %d+%d+%d”,a,b,a+b);
break;
case’-‘;
printf(“\n \t %d =%d”, a,b, a-b;
break;
case’*’;
prinff(“\n \t %d+%d=%d”, a,b, a*b);
break;
case’/’;
printf(“\n \t %d %d =%d”,a,b,a/b);
break;
printf(“\n \n press any key to list”);
getch();
}
}


Posted by: Wasim Javed

Write a program that will find the sum of those integers. Which are divisible by 2 and are not complete square. The integers should be less then 100

main()
{
int sum=0,I,t;
for(i=2;i<=100; i=i+2)
}
t=sqrt(i);
if(t*t t=i)
sum=sum+I;
}
printf(“%d”,sum);
}


Posted by: Wasim Javed

Program to find sum of digits (1-20) using if and goto statement

main()
{
int
clrscr();
n=1;
s=0;
abc;
s=s+n;
n=n+1;
if(n>=20)
goto abc;
print(“Sum of digits =%d\n”,s);
getch();
}


Posted by: Wasim Javed

This program will perform arithmetic operation depending on your choice (Switch Statement).

Main()
{
int a,b,ch;
printf(“Enter first number\n”);
scanf(“%d”,&a);
printf(“Enter second number\n”);
scanf(“%d”,&b);
printf(“ Enter your choice\n”);
scanf(“%d”,&ch
}
case 1: printf(“Addition =%d\n”,a+b);
break;
case 2: printf(“Subtraction =%d\n”,a-b);
case 3: printf(“Multiplication =%d\n”,a*b);
break;
case 4:printf (“Division=%d\n”,a/b);
break;
default:
printf(Invalid Choice\n”);
}


Posted by: Wasim Javed

A quick demo of nested if-else statement(Nested “If –Else” Statement)

main()
{
int l;
printf(“Enter either 1 or 2”);
scanf(“%d”,&l);
if (I == 1)
printf(“You would go to heavent\n”);
else
{
if(I ==2)
printf(“Hell was created with you in mind”);
else
printf(“How about mother earth l”);
getch();
}
}


Posted by: Wasim Javed

Write a program to input three integer values. Compare the three values to find out if they are equal .Use “ nested if statement”

Main()
{
int r,n,b;
clrscr();
printf(Enter first value ?\n”);
scanf(“%d”,&r);
printf(“Enter second value ?\n”);
scanf(“%d”,&n);
printf(“Enter third value ?\n”);
scanf(“%d”,&b);
if(r==n)
{
if(r==b)
printf(“All values are equal\n”);
}
else
printf(“These values are different\n”);
}


Posted by: Wasim Javed

Write a program to calculate the division obtained by the student(Using Else-if Statement).

Main()
{
int mks;
float per;
char g;
printf(“Enter your marks\n”);
scanf(“%d”,&mks);
per=mks*100/850;
if((per>=80)&&(per<=100))
g=’A’
else if ((per>=60)&&(per<=80))
g=’B’
else if ((per>=40)&&(per<=60))
g=’C’
else if ((per >= 30)&&(per< = 40))
g=’D’
else
printf (marks = %d\n”,mks);
printf (“marks = %f \n”,per);
printf(“marks =%c\n”,g);
getch();
}


Posted by: Wasim Javed

Write a program to calculate the division obtained by the student (Block of Statements).

Main()
{
int m1,m2,m3,m4,m5,per;
print(“Enter marks in five subjects”);
scanf(“%d %d %d %d %d”,&m1,&m2,&m3,&m4,&m5);
per=(m1+m2+m3+m4+m5)/5;
if(per>= 60)
printf(“First division”);
else
{
if ( per>=50)
printf(“Second division”);
else
{
if ( per >=40)
printf(“Third division”);
else
printf(“Fail”);
}
}
}

Posted by: Wasim Javed