Katrina Kaif: M.Tech
Katrina Kaif: M.Tech
PROCEDURE:
ALGORITHM:
FLOW CHART:
start
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main() {
clrscr();
printf(“KATRINA KAIF”);
getch(); }
OUTPUT:
PROCEDURE:
ALGORITHM:
FLOWCHART: Start
Declare a,b
Compute, c=a+b
d=a-b
g=a%b
e=a*b
f=a/b
print c, d, g, e, f
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main(){
int a,b,c,d,e,f,g;
clrscr();
printf("---Arithmetic operators---");
scanf("%d%d",&a,&b);
c=a+b;
d=a-b;
e=a*b;
f=a/b;
g=a%b;
printf("\n%d+%d=%d",a,b,c);
printf("\n%d-%d=%d",a,b,d);
printf("\n%d*%d=%d",a,b,e);
printf("\n%d/%d=%d",a,b,f);
printf("\n%d %%d=%d",a,b,g);
getch(); }
OUTPUT:
PROCEDURE:
ALGORITM:
Step 3: Compute the Sum of a and b and store the value in variable c
Step 5: Compute the product of a and b and store the value in variable e
FLOWCHART:
Start
Compute, c=a+b
d=a-b
e=a*b
f=a/b
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main() {
float a,b,c,d,e,f;
clrscr();
scanf("%f %f",&a,&b);
c=a+b;
printf("\n %f+%f=%f",a,b,c);
d=a-b;
printf("\n %f-%f=%f",a,b,d);
e=a*b;
printf("\n %f*%f=%f",a,b,e);
f=a/b;
printf("\n %f/%f=%f",a,b,f);
getch(); }
OUTPUT:
PROCEDURE:
ALGORITHM:
Step9: Compute the division value of a,b and store the value in variable f.
FLOWCHART:
Start
Read a, b values
c= a+b
Print c value
d= a-b
Print d value
e= a*b
Print e value
f= a/b
Print f value
g= a%b
Print g value
End
PROGRAM:
PROCEDURE:
ALGORITHM:
Step3:Read a, b, c, x;
Step5: print s
FLOWCHART:
Start
Declare a, b, c, s, x
Read a, b, c, x
Compute s=a*x*x+b*x+c
print s
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c,x,s;
clrscr();
scanf("%d %d %d %d",&a,&b,&c,&x);
s=(a*x*x)+(b*x)+c;
printf("s=(%d*%d*%d)+(%d*%d)+%d=%d",a,x,x,b,x,c,s);
getch();
OUTPUT:
12𝑥 3 8𝑥 2 𝑥 8
AIM: Write a C program to solve the given equation.X = 4𝑥
+ 4𝑥
+ 4𝑥 + 4𝑥
PROCEDURE:
ALGORITHM:
Step2: Declare a, b, c, d, e, x
Step3: Read x
FLOW CHART:
Start
Declare
a,b,c,d,e,x
Read x
Compute a =
(12*x*x*x)/(4*x)
Compute b =
(8*x*x)/(4*x)
Compute c =
x/(4*x)
Compute d =
8/(4*x)
Compute =
a+b+c+d
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
float a,b,c,d,e,x;
clrscr();
scanf(“%f”,&x);
a=(12*x*x*x)/4*x;
b=(8*x*x)/4*x;
c=x/(4*x);
d=8/(4*x);
e=a+b+c+d;
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
FLOWCHART:
PROGRAM:
PROGRAM:
ALGORITHM:
Step-6:-print c.
Step14: print c.
FLOW CHART:-
start
Declare a,bvariables
C=(a>b)&
TRUE &(a<c) FALSE
TRUE FALSE
c=(a>b)&&
(a>b)
C=(a<b)&&
TRUE (a<b) FALSE
TRUE FALSE
C=(a>b&&(
a<b)
TRUE FALSE
C=(a>b)||(
a<b)
TRUE FALSE
c=(a<b)||(
a<b)
c=(a<b)||(a
TRUE >b) FALSE
TRUE FALSE
c=!(a>b)
TRUE FALSE
C=!(a<b)
END
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
printf(“___Logical operators___”);
scanf("%d%d",&a,&b);
printf(“\nLogical And”);
c=(a>b)&&(a>b);
printf("\n(%d>%d)&&(%d>%d)=%d\n"a,b,c);
c=(a<b)&&(a<b);
printf("\n(%d<%d)&&(%d<%d)=%d\n"a,b,c);
c=(a<b)&&(a>b);
printf("\n(%d<%d)&&(%d>%d)=%d\n"a,b,c);
c=(a>b)&&(a<b);
printf("\n(%d>%d)&&(%d<%d)=%d\n"a,b,c);
printf(“\nLogical or”);
c=(a>b)||(a>b);
printf("\n(%d>%d)||(%d>%d)=%d\n"a,b,c);
c=(a<b)||(a<b);
printf("\n(%d<%d)||(%d<%d)=%d\n"a,b,c);
c=(a<b)||(a>b);
printf("\n(%d<%d)||(%d>%d)=%d\n"a,b,c);
c=(a>b)||(a<b);
printf("\n(%d>%d)||(%d<%d)=%d\n"a,b,c);
printf(“\nLogical not”);
c = !(a>b)
printf(“!(%d>%d)=%d”,a,b,c);
c = !(a<b)
printf(“!(%d<%d)=%d”,a,b,c);
getch();
OUTPUT:-
PROCEDURE:
ALGORITHM:
FLOWCHART:
Start
a+=b
Print a value
a-=b
Print a value
a*=b
Print a value
a/=b
Print a value
a%=b
Print a value
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main ()
int a,b;
scanf(“%d%d”,&a,&b);
printf(“\n---assignment operators---”);
printf(“\n%d+=%d”,a,(a+=b));
printf(“\n%d-=%d”,a,(a-=b));
printf(“\n%d*=%d”,a,(a*=b));
printf(“\n%d/=%d”,a,(a/=b));
printf(“\n%dmod=%d”,a,(a%=b));
getch();
OUTPUT:
PROCEDURE :
ALGORITHM :
Read a, b values
c=a&b
d=a|b
e=a<<b
f=a>>b
g=a^b
h=~a
Read c, d, e, f, g
and h values
Stop
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c,d,e,f,g,h;
clrscr();
scanf("%d%d",&a,&b);
c=a&b;
d=a|b;
e=a<<b;
f=a>>b;
g=a^b;
h=~a;
printf("a&b =%d\n",c);
printf("a|b =%d\n",d);
printf("a<<b =%d\n",e);
printf("a>>b =%d\n",f);
printf("a^b =%d\n",g);
printf("~a =%d\n",h);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step8: (a&128)>>7
Step9: (a&64)>>6
Step10: (a&32)>>5
Step11: (a&16)>>4
Step12: (a&8)>>3
Step13: (a&4)>>2
Step14: (a&2)>>1
Step15: (a&1)>>0
FLOWCHART:
Start
Declare a value
Read a value
Print (a&256)>>8
Print (a&128)>>7
Print (a&64)>>6
Print (a&32)>>5
Print (a&16)>>4
Print (a&8)>>3
Print (a&4)>>2
Print (a&2)>>1
Print (a&1)>>0
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int a;
clrscr();
scanf("%d",&a);
printf("\n %d",(a&256)>>8);
printf("%d",(a&128)>>7);
printf("%d",(a&64)>>6);
printf("%d",(a&32)>>5);
printf("%d",(a&16)>>4);
printf("%d",(a&8)>>3);
printf("%d",(a&4)>>2);
printf("%d",(a&2)>>1);
printf("%d",(a&1)>>0);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
a=a++
print a value
a=++a
print a value
a=a--
print a value
a=--a
print a value
b=b++
print b value
b=++b
print b value
b= b--
print b
b=--b
print b
c=(a++)+(++b)
print c
c=(a++)-(++b)
print c
c=(a--)+(--b)
print c
c=(a--)-(--b)
print c
c=(a++)*(++a)
print c
c=(a++)/(--a)
print c
c=(a--)*(--b)
print c
c=(a--)/(--b)
end
PROGRAM:
#include< stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter a,b:");
scanf("%d%d",&a,&b);
clrscr();
printf("\n (%d++)+(++%d)=%d",a,b,(a++)+(++b));
printf("\n (%d++)-(++%d)=%d",a,b,(a++)-(++b));
printf("\n (%d--)+(--%d)=%d",a,b,(a--)+(--b));
printf("\n (%d--)-(--%d)=%d",a,b,(a--)-(--b));
printf("\n (%d++)*(++%d)=%d",a,b,(a++)*(++b));
printf("\n (%d++)/(++%d)=%d",a,b,(a++)/(++b));
printf("\n (%d--)*(--%d)=%d",a,b,(a--)*(--b));
printf("\n (%d--)/(--%d)=%d",a,b,(a--)/(--b));
printf("\n (++%d)=%d",a,(++a));
printf("\n (%d++)=%d",a,(a++));
printf("\n (--%d)=%d",a,(--a));
printf("\n (%d--)=%d",a,(a--));
printf("\n (++%d)=%d",b,(++b));
printf("\n (%d++)=%d",b,(b++));
printf("\n (--%d)=%d",b,(--b));
printf("\n (%d--)=%d",b,(b--));
getch( );
}
OUTPUT:
PROCEDURE:-
ALGORITHM :
Step 4: Check a mod 2==0,if true print even number ,if false print odd
number
Step 6: Check a greater than 0 ,if true print positive number,if false print
negative number
Step 8: Check a greater than b and a greater than c if true print a greater or
b greater than a and b greater than c if true print b is greater ,if false print c
is greater
Step 10: Check year mod 4==0 if true print leap year,if false print not leap
year
Step 12: Check age greter than 18 if true print eligible ,if false print not
eligible
Step 14: Check nod is greater than or equal to 2 if true print egilible,if false
print not eligible
Step 16: Check age greater than 18 if true print eligible,if false print not
eligible
Step 18: Check a==0 or a==1 if true print neither prime nor composite,if
false check a mod 2 greater than 0 or a==2 and a mod 3 greater than 0 or
a==3 and a mod 5 greater than 0 or a==5 and a mod 7 greater than 0 or
a==7 if true print prime,if false print composite
PROGRAM :
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c,age,weight,year,nod;
clrscr();
printf("\n____conditional operators___");
printf("\n_____even or odd_____");
printf("\nenter a value=");
scanf("%d",&a) ;
printf("\n_____positive or negative_____");
printf("\nenter a value=");
scanf("%d",&a);
scanf("%d%d%d",&a,&b,&c);
(a>b)&&(a>c)?printf("%d is greater",a):(b>a)&&(b>c)?printf("%d is
greater",b):printf("%d is grater",c);
printf("\n_____Leap year____");
printf("\nenter year=");
scanf("%d",&year);
scanf("%d",&age);
(age>=18)?printf("eligible"):printf("not elgible");
printf("\n_______blood donation______");
scanf("%d%d",&age,&weight);
printf("\n___Booster dose____");
printf("\nenter no of doses=");
scanf("%d",&nod);
(nod>=2)?printf("eligible"):printf("not eligible");
printf("\n___voting____");
scanf("%d",&age);
(age>18)?printf("eligible"):printf("not eligible");
printf("\n______prime or composite____");
scanf("%d",&a);
getch();
OUTPUT :
AIM: Write a C program using Special operators by using all data types.
PROCEDURE:
ALGORITHM:
different types
STEP-3: Print the size and address of variable ‘a’ which is in ‘int’ data
type
STEP-4: Print the size and address of variable ‘b’ which is in ‘short int’
data type
STEP-5: Print the size and address of variable ‘c’ which is in ‘unsigned
STEP-6: Print the size and address of variable ‘d’ which is in ‘unsigned
STEP-7: Print the size and address of variable ‘e’ which is in ‘long int’
data type
STEP-8: Print the size and address of variable ‘f’ which is in ‘unsigned
STEP-9: Print the size and address of variable ‘g’ which is in ‘long long
STEP-10: Print the size and address of variable ‘h’ which is in ‘usigned
STEP-11: Print the size and address of variable ‘i’ which is in ‘char’ data
type
STEP-12: Print the size and address of variable ‘j’ which is in ‘unsigned
STEP-13: Print the size and address of variable ‘k’ which is in ‘signed
STEP-14: Print the size and address of variable ‘l’ which is in ‘float’ data
type
STEP-15: Print the size and address of variable ‘m’ which is in ‘double’
data type
STEP-16: Print the size and address of variable ‘n’ which is in ‘long
FLOWCHART:
Start
Declare variables
int a,
short int b,
unsigned int c,
unsigned short int d,
long int e,
unsigned long int f,
long long g,
unsigned long long int h,
char I,
unsigned char j,
signed char k,
float l,
double m,
long double n
End
PROGRAM:
ALGORITHM:-
Step-3:-Read r value.
Step-6:-Read p, t, r values.
Step-8:-Print si value.
Step-9:-Read c value.
Step-11:-Print f value.
Step-12:-Read f value.
Step-14:-print c value.
FLOW CHART:-
Start
Read r value
Compute
area=3.14*r*r
Print area
Compute
si=(p*t*r)/100
Print si value
Read c value
Compute
f=c*1.800+32.00
Print f value
Read f value
Compute
c=f-32/1.800
Print c value
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
float r,area,si,p,t,rt,c,f;
clrscr();
scanf("%f",&r);
area=3.14*r*r;
printf("\narea=%f",area);
scanf("%f%f%f",&p,&t,&rt);
si=(p*t*rt)/100;
printf("\nsimple interest=%f",si);
scanf("%f",&c);
f=(c*1.800)+32.00 ;
printf("\nfahrenheit=%f",f);
scanf("%f",&f);
c=(f-32)/1.800;
printf("\ncelcius=%f",c);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step 3: equate b as b = 1.
FLOWCHART:
start
C=a*b
Increment by 1
yes
Is b<11
no
Print c value
End
PROGRAM:
#include<conio.h>
#include<stdio.h>
void main()
int a,b=1;
clrscr();
printf("enter a value(table)");
scanf("%d",&a);
printf("\n%d*%d=%d",a,b,(a*b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
printf("\n%d*%d=%d",a,b,(a*++b));
getch();
OUTPUT:
ALGORITHM :
FLOW CHART :
Start
Read a,b
compute c = (b%10)*a
d=(b/10)*a
Print c,d
Compute
e = c+(d*10)
Print e
End
PROGRAM :
// c program on multipication of two numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e;
clrscr();
printf("\nenter a b values : ");
scanf("%d%d",&a,&b);
printf("\n-----MULTIPLICATION OF TWO NUMBERS-----");
printf("\n\n\t %d\n\tx%d",a,b);
c=(b%10)*a;
d=(b/10)*a;
printf("\n--------------");
printf("\n%d * %d = %d",b%10,a,c);
printf("\n%d * %d = %d",b/10,a,d);
printf("\n--------------");
printf("\nAddition= %d",c+(d*10));
printf("\n--------------");
getch();
}
OUTPUT :
PROCEDURE:
ALGORITHM:
Step 2: Read a, b, c
Step 4: a =a+(b+c)
Step 5: b = a-(b+c)
Step 6: c = a-(b+c)
Step 7: a =a-(b+c)
FLOWCHART:
Start
Read a,b,c
compute
a=a+b+c,
b=a-(b+c),
c=a-(b+c),
a=a-(b+c)
Print a,b,c
Stop
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
scanf("%d%d%d",&a,&b,&c);
a=a+b+c;
b=a-(b+c);
c=a-(b+c);
a=a-(b+c);
printf("\nAfter swapping:-");
printf("\na=%d\nb=%d\nc=%d",a,b,c);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step 6: Repeat the Steps three, four and five for another three times.
FLOWCHART:
start
i=num/10
rev=rev*10+i
NO
If rev=0
YES
Display rev
Stop
PROGRAM :
#include<stdio.h>
#include<conio.h>
void main()
int rev=0,num,i;
clrscr();
printf("enter a number");
scanf("%d",&num);
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
getch();
OUTPUT :
PROCEDURE :
ALGORITHM :
STEP 7: Repeat the steps three,four and five for another three times.
FLOWCHART:
print palindrome
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int rev=0,num,i,a;
clrscr();
scanf("%d",&num);
a=num;
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
i=num%10;
rev=rev*10+i;
num=num/10;
a==rev?printf("\npalindrome"):printf("\nnot a palindrome");
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Number.
FOWCHART:
Start
Declare a,
b,i=0,g=a values
Read a value
False True
Is i>3?
b=a%10sum+=b*b
*b*b
False True
g ==
sum
End
Program:
PROCEDURE:-
ALGORITHM:-
Step-3:- compute a0ht/2 and store in a1wd and store a0wd in a1ht.
Step-5:- compute a1ht/2 and store in a2wd and store a1wd in a2ht.
Step-6:-print a2ht*a2wd.
Step-7:- compute a2ht/2 and store in a3wd and store a2wd in a3ht.
Step-8:-print a3ht*a3wd.
Step-9:- compute a3ht/2 and store in a4wd and store a3wd in a4ht.
Step-10:-print a4ht*a4wd.
Step-11:- compute a4ht/2 and store in a5wd and store a4wd in a5ht.
Step-13:- compute a5ht/2 and store in a6wd and store a5wd in a6ht.
Step-14:-print a6ht*a6wd.
Step-15:- compute a6ht/2 and store in a7wd and store a6wd in a7ht.
Step-16:-print a7ht*a7wd.
Step-17:- compute a7ht/2 and store in a8wd and store a7wd in a8ht.
Step-19:- compute a8ht/2 and store in a9wd and store a8wd in a9ht.
Step-20:-print a9ht*a9wd.
a10ht.
Step-22:-print a10ht*a10wd.
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int a0ht=1189, a0wd=841 , a1ht , a2ht , a3ht , a4ht , a5ht , a6ht , a7ht ,
a8ht , a9ht , a10ht , a10wd , a1wd , a2wd , a3wd , a4wd , a5wd , a6wd ,
a7wd , a8wd , a9wd ;
clrscr();
printf("_________SIZE OF PAPERS_________\n");
printf("size of a0 paper=%dmm*%dmm\n",a0ht,a0wd,(a0ht*a0wd));
a1ht=a0wd,a1wd=a0ht/2;
printf("size of a1 paper=%dmm*%dmm\n",a1ht,a1wd,(a1ht*a1wd));
a2ht=a1wd,a2wd=a1ht/2;
printf("size of a2 paper=%dmm*%dmm\n",a2ht,a2wd,(a2ht*a2wd));
a3ht=a2wd,a3wd=a2ht/2;
printf("size of a3 paper=%dmm*%dmm\n",a3ht,a3wd,(a3ht*a3wd));
a4ht=a3wd,a4wd=a3ht/2;
printf("size of a4 paper=%dmm*%dmm\n",a4ht,a4wd,(a4ht*a4wd));
a5ht=a4wd,a5wd=a4ht/2;
printf("size of a5 paper=%dmm*%dmm\n",a5ht,a5wd,(a5ht*a5wd));
a6ht=a5wd,a6wd=a5ht/2;
printf("size of a6 paper=%dmm*%dmm\n",a6ht,a6wd,(a6ht*a6wd));
a7ht=a6wd,a7wd=a6ht/2;
printf("size of a7 paper=%dmm*%dmm\n",a7ht,a7wd,(a7ht*a7wd));
a8ht=a7wd,a8wd=a7ht/2;
printf("size of a8 paper=%dmm*%dmm\n",a8ht,a8wd,(a8ht*a8wd));
a9ht=a8wd,a9wd=a8ht/2;
printf("size of a9 paper=%dmm*%dmm\n",a9ht,a9wd,(a9ht*a9wd));
a10ht=a9wd,a10wd=a9ht/2;
printf("_______________________________");
getch();
OUTPUT :-
AIM: Write a C program to find the number of notes that will combine to
give Rs Note.
PROCEDURE:
ALGORITHM:
Step2: Declare and Read the variables Amount, Hundred, Fifty, Twenty,
FLOWCHART:
Start
Read amount
Compute
Hundred=Amount/100,
Amount=Amount%100,
Fifty=Amount/50,
Amount=Amount%50,
Twenty=Amount/20,
Amount=Amount%20,
Ten=Amount/10,
Amount=Amount%10,
Five=Amount/5,
Amount=Amount%5,
One=Amount/1,
Amount=Amount%1
Print Hundred,Fifty,twenty,Ten,Five,One
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int Amount,Hundred,Fifty,Twenty,Ten,Five,One;
clrscr();
scanf("%d",&Amount);
Hundred=Amount/100;
Amount=Amount%100;
Fifty=Amount/50;
Amount=Amount%50;
Twenty=Amount/20;
Amount=Amount%20;
Ten=Amount/10;
Amount=Amount%10;
Five=Amount/5;
Amount=Amount%5;
One=Amount/1;
Amount=Amount%1;
printf("\n Hundred =%d notes\n Fifty =%d notes\n Twenty =%d notes
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step2: Declare and Read the id, basic, hra, da, mtechinc, tsinc, total1,
Step16: Print basic, gis, hra, pta, da, cps, mtechinc, inc, tsinc, total1,
total2, basic+total1,basic+total1-total2.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
float id,basic,hra,da,mtechinc,tsinc,total1,total2,gis,ptax,cps,inc;
int a;
clrscr();
scanf("%d",&id);
scanf("%f",&basic);
hra=(basic*27)/100;
da=(basic*38)/100;
mtechinc=(basic*0.5)/100;
tsinc=(basic*0.12)/100;
gis=(basic*0.02)/100;
ptax=(basic*0.03)/100;
cps=(basic+da)*0.1;
inc=(basic*1.5)/100;
total1=hra+da+mtechinc+tsinc;
total2=gis+ptax+cps+inc;
printf("\n -----------------------------------------------------");
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step2: Declare and Read the variables eng, mat, phy, che, tel, hin, id
,total, per
PROGRAM:
#include <stdio.h>
#include<conio.h>
void main()
int eng,mat,phy,che,tel,hin,id,total;
float per;
clrscr();
scanf("%d",&id);
scanf("%d",&eng);
scanf("%d",&mat);
scanf("%d",&phy);
scanf("%d",&che);
scanf("%d",&tel);
scanf("%d",&hin);
total=eng+mat+phy+che+tel+hin;
per=(total/6);
printf("\n ------------------------");
printf("\n ------------------------");
getch();
OUTPUT:
number.
PROCEDURE:
ALGORITHM:
FLOWCHART:
Start
Read num
Compute
years=num/365,
num=num%365,
months=num/30,
num=num%30,
weeks=num/7,
num=num%7,
days=num
Print years,
months,weeks,
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int num,years,months,weeks,days;
clrscr();
scanf("%d",&num);
years=num/365;
num=num%365;
months=num/30;
num=num%30;
weeks=num/7;
num=num%7;
days=num;
years,months,weeks,days);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step4: (x==’a’, x==’e’, x==’i’, x==’o’, x==’u’, x==’A’, x==’E’, x==’I’, x==’O’,
FLOWCHART:
Start
Declare x variable
Read x variable
((x==’a’)||(x==’e’)||(x=
=’i’)||(x==’o’)||(x==’u’)
Yes ||(x==’A’)||(x==’E’)||( No
x==’I’)||(x==’O
’)||(x==’U ’))
End
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
char x;
clrscr();
scanf(“%c”,&x);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
FLOWCHART:
Start
Read the
character p
False
True (p>=’a’)&&(p<=’
z’)||(p>=’A’)&&
p(<=’Z’)
Print digit
Print symbol
Stop
PROGRAM:
Special symbol*/
#include<stdio.h>
#include<conio.h>
void main()
char p;
clrscr();
printf(“enter p value=”);
scanf(“%c”,&p);
((p>=’a’)&&(p<=’z’)||(p>=’A’)&&(p<=’Z’)?printf(“%c is an alphabet”,c):(p>=’0’)
&&(p<=’9’)?printf(“%c is a digit”,p):printf(“%c is a special symbol”,p);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step1: Declare the variable “A” to integer “A1” variable to a short integer
2,147,483,900
Step6: Declare the variable “B” to float “B1” variable to a double and
Step10: Declare C1 variable as unsigned short integer and put the value
of C1to 255.
C2 to 65000
value of C3 to 34*100000000.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main ()
int A;
float B;
double B1=(double)22/7;
char D1='c';
clrscr();
scanf("%d %f",&A,&B);
getch(); }
OUTPUT:
PROCEDURE:
ALGORITHM :
integer hd, long integer lu, unsigned long long integer llu, float
STEP 3: Declare short int c, long int d, long long int e, float f, double g,
STEP 4: Assign a+b expression with the data type short int using explicit
technique.
STEP 5: Assign a+b expression with the data type long int using explicit
technique.
STEP 6: Assign a+b expression with the data type long long int using
explicit technique.
STEP 7: Assign a+b expression with the data type float using explicit
technique.
STEP 8: Assign a+b expression with the data type double using explicit
technique.
STEP 9: Assign a+b expression with the data type long double using
explicit technique.
STEP 10: Assign a+b expression with the data type char using explicit
technique.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main(){
int i;charc;unsigned char uc;signed char sc;short int hd;long int ld;
llu=lu=Lf=lf=f=lld=ld=hd=sc=uc=c=i;
scanf("%d",&i);
llu=lu=Lf=lf=f=lld=ld=hd=sc=uc=c=i;
printf("char = %c \n",c);
printf("float = %f \n",f);
getch();
OUTPUT:
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main(){
int a,b;
clrscr();
scanf("%d %d",&a,&b);
printf("char = %c \n",(char)a+b);
printf("unsigned long long int = %llu \n",(unsigned long long int) a+b);
getch();
OUTPUT:
AIM: Write a C program to enter a name and display name using an Array.
PROCEDURE:
ALGORITHM:
FLOWCHART:
Start
Declare name[50]
variable
Read
name[50]
Print
name[50]
End
PROGRAM:
PROCEDURE:
ALGORITHM:
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#definemohd 60
#definesubhan 121
#defineTvprice 20000
#if(subhan==121)
#undefsubhan
#endif
void main(){
int a,b,c,d;
clrscr();
#ifndef __MATH_H
#endif
#ifdefsubhan
#endif
#ifdefmohd
printf("pinno.%d is present",mohd);
#else
printf("pinno.%d is absent",mohd);
#endif
#if(Tvprice>20000)
#elif(Tvprice<=3000)
#else
#endif
scanf("%d%d%d",&a,&b,&c);
getch();
OUTPUT:
PROCEDURE:
ALGORITHM:
Step1: start the program.
FLOWCHART:
Start
Declare a value
Read a
value
End
PROGRAM:
//Program on math.h header file.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main(){
float a;clrscr();
printf("------Using Math.h Header File------\n");printf("\n");
printf("Enter a number: ");
scanf("%f",&a);
printf("sqrt(%.2f) = %.2f \n",a,sqrt(a));
printf("pow(%.2f,2.00) = %.2f \n",a,pow(a,2.0));
printf("log(%.2f) = %.2f \n",a,log(a));
printf("log10 = %.2f \n",log10(a));
printf("fabs(%.2f) = %.2f \n",a,fabs(a));
printf("exp = %.2f \n",exp(a));
printf("ceil = %.2f \n",ceil(a));
printf("floor = %.2f \n",floor(a));
printf("fmod(%.2f,3.00) = %.2f \n",a,fmod(a,3.0));
printf("sin%.2f = %.2f\n",a,sin(a));
printf("cos%.2f = %.2f \n",a,cos(a));
printf("tan%.2f = %.2f \n",a,tan(a));
getch();
}
OUTPUT:
ALGORITHM:
FLOWCHART:
Start
Declare a,
name[50] ;
Read name[50]
using gets
printname[50]
using puts
Read a value
Print a value
read name[50]
Print name[50]
End
PROGRAM:
OUTPUT: