100% found this document useful (2 votes)
2K views

HSC Programming Language Practical

The document describes 3 programs: 1) A program to convert Celsius to Fahrenheit. It takes Celsius temperature as input and prints the Fahrenheit equivalent. 2) A program to find the largest of 3 numbers entered by the user. 3) A program to calculate the area of a triangle given the lengths of 3 sides. It takes the 3 side lengths as input and prints the area.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views

HSC Programming Language Practical

The document describes 3 programs: 1) A program to convert Celsius to Fahrenheit. It takes Celsius temperature as input and prints the Fahrenheit equivalent. 2) A program to find the largest of 3 numbers entered by the user. 3) A program to calculate the area of a triangle given the lengths of 3 sides. It takes the 3 side lengths as input and prints the area.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

r

Z_¨ I †hvMv‡hvM cÖhyw³ (e¨envwiK)

i to
cÂg Aa¨vq

Ed
wm-‡cÖvMÖvwgs
cÖwZ‡e`b-1 t †mw›U‡MÖW ZvcgvÎv‡K d‡ibnvBU ZvcgvÎvq iƒcvšÍ‡ii †cÖvMÖvg |

ZË¡ t scanf ( ) dvskb e¨envi K‡i Kx‡evW© n‡Z †mw›U‡MÖW ZvcgvÎv (C) MÖnY Ki‡Z n‡e| AZcit

F
F=9*C/5+32 m~Î e¨envi K‡i M„nxZ †mw›U‡MÖW ZvcgvÎv‡K d‡ibnvBU †¯‹‡j iƒcvšÍi Ki‡Z n‡e|

PD
hš¿cvwZi e¨envi t
(K) nvW©Iqvi t GKwU Kw¤úDUvi |
(L) md&UIqvi t Acv‡iwUs wm‡÷g t Windows 7
md&UIqvi t Codeblocks
(M) e¨envi t DwjøwLZ cixÿYwU m¤úbœ Ki‡Z hš¿cvwZ e¨env‡ii ‡ÿ‡Î wb‡Pi c×wZ
AbymiY Kwi-
te r
 Kv‡Ri ïiæ‡Z Kw¤úDUv‡i •e`y¨wZK ms‡hvM w`‡Z n‡e|
 Kw¤úDUv‡ii cvIqvi myBP Ab K‡i Kw¤úDUviwU Pvjy Ki‡Z n‡e|
 DwjøwLZ md&Uqvi¸‡jv Kw¤úDUv‡i Bb÷j Av‡Q wK bv Zv †`‡L wb‡Z n‡e|
as

 ewY©Z cixÿYwU n‡j PvjyK…Z †cÖvMÖvgmg~n eÜ Ki‡Z n‡e Ges wbqgvbyhvqx Kw¤úDUviwU eÜ /
kvU WvDb Ki‡Z n‡e| cÖ‡qvR‡b •e`y¨wZK myBP eÜ K‡i we`y¨r ms‡hvM wew”Qbœ Ki‡Z n‡e|
cÖwµqv AbymiY t Codeblocks md&UIqviwU Pvjy K‡i wb¤œwjwLZ avc¸‡jv AbymiY Kwi-
nM

avc 1t File – New – Empty File wK¬K K‡i bZzb GKwU dvBj Lywj|
avc 2t File – Save file as wK¬K Kwi|
avc 3t File name G dvB‡ji bvg w`‡q Ges Save as type C/C++files wm‡j± K‡i Save
evU‡b wK¬K Kwi|
di

avc 4t wm j¨vs¸‡qR e¨envi K‡i wb‡Pi †KvW¸‡jv wjwL|


#include<stdio.h>
main()
{
a te

float f,c;
printf("Enter Centregrade Temparature ");
scanf("%f",&c);
f=(9*c)/5+32;
printf("The result is %f",f);
re

Page 1
r
i to
avc 5 t Build evU‡b wK¬K K‡i †cÖvMÖvgwU‡K K¤úvBj K‡i wWevwMs Kwi|
avc 6 t Run evU‡b wK¬K K‡i †cÖvMÖvgwU‡K Pvjy K‡i 34 (‡mw›U‡MÖW ZvcgvÎv) BbcyU w`B|
avc 7 t Enter evU‡b wK¬K Ki‡j djvdj cvIqv hvq|

Ed
djvdj t

Enter Temperature in Celsius : 34


The Temperature in Fahrenheit is : 93.20
Process returned 0(0x0) execution time : 7.031 s Press any key to continue.

F
e¨vL¨v t GB †cÖvMªv‡g e¨eüZ wm j¨vs¸‡q‡Ri †Kv‡Wi e¨vL¨v wb‡¤œ †`qv n‡jv-
* C, F ‡d¬v‡qU UvB‡ci †fwi‡qe‡ji Rb¨ folat KxIqvW© e¨envi Kiv n‡q‡Q|

PD
* scanf ( ) dvskb e¨envi K‡i C Gi gvb Kx‡ev‡W©i mvnv‡h¨ BbcyU †bqv n‡q‡Q|
* F=9*C/5+32 m~Î e¨envi K‡i M„nxZ †mw›U‡MÖW ZvcgvÎv‡K dv‡ibnvBU †¯‹‡j iƒcvšÍi Kiv
n‡q‡Q|
* Printf ( ) dvskb e¨envi K‡i AvDUcyU cÖ`k©b Kiv n‡q‡Q|
te r
A¨vjMwi`g
avc 1 t ïiæ|
avc 2 t †mjwmqvm †¯‹‡j ZvcgvÎvq gvb MÖnY|
as

avc 3 t F=9*C/5+32 m~Î e¨envi K‡i dv‡ibnvBU ‡¯‹‡j ZvcgvÎv wbY©q|


avc 4 t dv‡ibnvBU †¯‹‡j ZvcgvÎ cÖ`k©Y|
avc 5 t †kl|
†d¬vPvU©
nM

ïiæ

C Gi gvb MÖnY
di

F=9*C/5+32

F Gi gvb cÖ`k©b
a te

†kl
re

Page 2
r
i to
cÖwZ‡e`b-2 t wZbwU msL¨vi g‡a¨ eo msL¨v wbY©‡qi †cÖvMÖvg |

Ed
ZË¡ t scanf ( ) dvskb e¨envi K‡i Kx‡evW© n‡Z wZbwU msL¨v MÖnY Ki‡Z n‡e|
hš¿cvwZi e¨envi t
(K) nvW©Iqvi t GKwU Kw¤úDUvi |
(L) md&UIqvi t Acv‡iwUs wm‡÷g t Windows 7
md&UIqvi t Codeblocks

F
(M) e¨envi t DwjøwLZ cixÿYwU m¤úbœ Ki‡Z hš¿cvwZ e¨env‡ii ‡ÿ‡Î wb‡Pi c×wZ AbymiY Kwi-
 Kv‡Ri ïiæ‡Z Kw¤úDUv‡i •e`y¨wZK ms‡hvM w`‡Z n‡e|

PD
 Kw¤úDUv‡ii cvIqvi myBP Ab K‡i Kw¤úDUviwU Pvjy Ki‡Z n‡e|
 DwjøwLZ md&Uqvi¸‡jv Kw¤úDUv‡i Bb÷j Av‡Q wK bv Zv †`‡L wb‡Z n‡e|
 ewY©Z cixÿYwU n‡j PvjyK…Z †cÖvMÖvgmg~n eÜ Ki‡Z n‡e Ges wbqgvbyhvqx Kw¤úDUviwU eÜ /
kvU WvDb Ki‡Z n‡e| cÖ‡qvR‡b •e`y¨wZK myBP eÜ K‡i we`y¨r ms‡hvM wew”Qbœ Ki‡Z n‡e|
te r
cÖwµqv AbymiY t Codeblocks md&UIqviwU Pvjy K‡i wb¤œwjwLZ avc¸‡jv AbymiY Kwi-
avc 1t File – New – Empty File wK¬K K‡i bZzb GKwU dvBj Lywj|
avc 2t File – Save file as wK¬K Kwi|
avc 3t File name G dvB‡ji bvg w`‡q Ges Save as type C/C++files wm‡j± K‡i Save
as

evU‡b wK¬K Kwi|


avc 4t wm j¨vs¸‡qR e¨envi K‡i wb‡Pi †KvW¸‡jv wjwL|
#include<stdio.h>
nM

main()
{
int a,b,c;
printf("Enter the first number ");
scanf("%d",&a);
printf("Enter the second number ");
scanf("%d",&b);
di

printf("Enter the third number ");


scanf("%d",&c);
if(a>b&&a>c)
printf("The largest number is %d",a);
a te

if(b>c&&b>a)
printf("The largest number is %d",b);
if(c>a&&c>b)
printf("The largest number is %d",c);
re

}
Page 3
r
i to
avc 5 t Build evU‡b wK¬K K‡i †cÖvMÖvgwU‡K K¤úvBj K‡i wWevwMs Kwi|
avc 6 t Run evU‡b wK¬K K‡i †cÖvMÖvgwU‡K Pvjy K‡i wZbwU msL¨v a = 6,b = 3,c = 9 BbcyU w`B|
avc 7 t Enter evU‡b wK¬K Ki‡j djvdj cvIqv hvq|

Ed
Enter the first number 6
Enter the second number 3
djvdj t Enter the third number 9
The largest number is 9
The area is 11.618950

F
Process returned 23 (0*17) execution time : 14.621 s
Press any key to continue
e¨vL¨v t GB †cÖvMªv‡g e¨eüZ wm j¨vs¸‡q‡Ri †Kv‡Wi e¨vL¨v wb‡¤œ †`qv n‡jv-

PD
* a,b,c Integer UvB‡ci †fwi‡qe‡ji Rb¨ int KxIqvW© e¨envi Kiv n‡q‡Q|
* scanf ( ) dvskb e¨envi K‡i a,b,c Gi gvb Kx‡ev‡W©i mvnv‡h¨ BbcyU †bqv n‡q‡Q|

* wZbwU if condition e¨envi K‡i wZbwU msL¨vi g‡a¨ eo msL¨vwU wbY©q Kiv
n‡q‡Q|
te r
* Printf ( ) dvskb e¨envi K‡i AvDUcyU cÖ`k©b Kiv n‡q‡Q|
as

A¨vjMwi`g
nM

avc 1 t start
avc 2 t read a,b,c
avc 3 t if a>b and a>c print a is the largest number.
avc 4 t goto step (8)
di

avc 5 t else if b>c and b>a print b is the largest number.


avc 6 t goto step (8)
avc 7 t else if c>b and c>a print c is the largest number.
a te

avc 8 t stop
re

Page 4
r
i to
Flowchart

start

Ed
read a,b,c

False True
If(a>b and a>c)

F
False True Print a is the largest
If(a>b and a>c)

PD
print b is the largest
If(a>b and a>c)
te r
print print c is the largest
as

stop
nM

cÖwZ‡e`b-3 t wÎfz‡Ri wZb evûi gvb †_‡K †ÿÎdj wbY©q Kivi †cÖvMÖvg |

ZË¡ t scanf ( ) dvskb e¨envi K‡i Kx‡evW© n‡Z wÎfz‡Ri wZb evûi gvb MÖnY Ki‡Z n‡e| AZcit
s=(a+b+c)/2Ges area=sqrt(s*(s-a)*(s-b)*(s-c))m~Î e¨envi K‡i wÎfz‡Ri wZb evûi gvb †_‡K
†ÿÎdj wbY©q Ki‡Z n‡e|
di

hš¿cvwZi e¨envi t
(K) nvW©Iqvi t GKwU Kw¤úDUvi |
(L) md&UIqvi t Acv‡iwUs wm‡÷g t Windows 7
a te

md&UIqvi t Codeblocks
(M) e¨envi t DwjøwLZ cixÿYwU m¤úbœ Ki‡Z hš¿cvwZ e¨env‡ii ‡ÿ‡Î wb‡Pi c×wZ AbymiY Kwi-
 Kv‡Ri ïiæ‡Z Kw¤úDUv‡i •e`y¨wZK ms‡hvM w`‡Z n‡e|
 Kw¤úDUv‡ii cvIqvi myBP Ab K‡i Kw¤úDUviwU Pvjy Ki‡Z n‡e|
 DwjøwLZ md&Uqvi¸‡jv Kw¤úDUv‡i Bb÷j Av‡Q wK bv Zv †`‡L wb‡Z n‡e|
re

Page 5
r
i to
 ewY©Z cixÿYwU n‡j PvjyK…Z †cÖvMÖvgmg~n eÜ Ki‡Z n‡e Ges wbqgvbyhvqx Kw¤úDUviwU eÜ /
kvU WvDb Ki‡Z n‡e| cÖ‡qvR‡b •e`y¨wZK myBP eÜ K‡i we`y¨r ms‡hvM wew”Qbœ Ki‡Z n‡e|

Ed
cÖwµqv AbymiY t Codeblocks md&UIqviwU Pvjy K‡i wb¤œwjwLZ avc¸‡jv AbymiY Kwi-
avc 1t File – New – Empty File wK¬K K‡i bZzb GKwU dvBj Lywj|
avc 2t File – Save file as wK¬K Kwi|
avc 3t File name G dvB‡ji bvg w`‡q Ges Save as type C/C++files wm‡j± K‡i Save
evU‡b wK¬K Kwi|

F
avc 4t wm j¨vs¸‡qR e¨envi K‡i wb‡Pi †KvW¸‡jv wjwL|

PD
#include<stdio.h>
main()
{
float a,b,c,s,area;
printf("Enter the value of a ");
scanf("%f",&a);
printf("Enter the value of b ");
te r
scanf("%f",&b);
printf("Enter the value of c ");
scanf("%f",&c);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("the area is %f",area);
as

avc 5 t Build evU‡b wK¬K K‡i †cÖvMÖvgwU‡K K¤úvBj K‡i wWevwMs Kwi|
nM

avc 6 t Run evU‡b wK¬K K‡i †cÖvMÖvgwU‡K Pvjy K‡i wÎey‡Ri wZb evûi gvb a = 6,b = 8,c = 4 BbcyU w`B|
avc 7 t Enter evU‡b wK¬K Ki‡j djvdj cvIqv hvq|

Enter the value of a 6


Enter the value of b 8
di

djvdj t Enter the value of c 4


The area is 11.618950
Process returned 21 (0*15) execution time : 13.899 s
Press any key to continue
a te

e¨vL¨v t GB †cÖvMªv‡g e¨eüZ wm j¨vs¸‡q‡Ri †Kv‡Wi e¨vL¨v wb‡¤œ †`qv n‡jv-


* a,b,c ‡d¬v‡qU UvB‡ci †fwi‡qe‡ji Rb¨ float KxIqvW© e¨envi Kiv n‡q‡Q|
* scanf ( ) dvskb e¨envi K‡i a,b,c Gi gvb Kx‡ev‡W©i mvnv‡h¨ BbcyU †bqv n‡q‡Q|
* s=(a+b+c)/2Ges area=sqrt(s*(s-a)*(s-b)*(s-c))m~Î e¨envi K‡i wÎfz‡Ri wZb evûi
re

gvb †_‡K †ÿÎdj wbY©q Kiv n‡q‡Q|


Page 6
r
i to
* Printf ( ) dvskb e¨envi K‡i AvDUcyU cÖ`k©b Kiv n‡q‡Q|
A¨vjMwi`g
avc 1 t start

Ed
avc 2 t read a,b,c
avc 3 tcalculate s=(a+b+c)/2
avc 4 calculate area= ( − )( − )( − )
avc 5 t print area

F
avc 6 t stop

PD
†d¬vPvU©
start

read a,b,c
te r
s=(a+b+c)/2

area= 𝒔( 𝒔 − 𝒂)(𝒔 − 𝒃)(𝒔 − 𝒄)


as

𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐) 𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠


print area
nM

stop

cÖwZ‡e`b-4 t + + + .........+ avivi †hvMdj wbY©‡qi †cÖvMÖvg |

ZË¡ t scanf ( ) dvskb e¨envi K‡i Kx‡evW© n‡Z n Gi gvb MÖnY Ki‡Z n‡e| AZcit
di

for loop e¨envi K‡i avivi †hvMdj Ki‡Z n‡e|

hš¿cvwZi e¨envi t
a te

(K) nvW©Iqvi t GKwU Kw¤úDUvi |


(L) md&UIqvi t Acv‡iwUs wm‡÷g t Windows 7
md&UIqvi t Codeblocks
(M) e¨envi t DwjøwLZ cixÿYwU m¤úbœ Ki‡Z hš¿cvwZ e¨env‡ii ‡ÿ‡Î wb‡Pi c×wZ AbymiY Kwi-
 Kv‡Ri ïiæ‡Z Kw¤úDUv‡i •e`y¨wZK ms‡hvM w`‡Z n‡e|
re

Page 7
r
i to
 Kw¤úDUv‡ii cvIqvi myBP Ab K‡i Kw¤úDUviwU Pvjy Ki‡Z n‡e|
 DwjøwLZ md&Uqvi¸‡jv Kw¤úDUv‡i Bb÷j Av‡Q wK bv Zv †`‡L wb‡Z n‡e|
 ewY©Z cixÿYwU n‡j PvjyK…Z †cÖvMÖvgmg~n eÜ Ki‡Z n‡e Ges wbqgvbyhvqx Kw¤úDUviwU eÜ /

Ed
kvU WvDb Ki‡Z n‡e| cÖ‡qvR‡b •e`y¨wZK myBP eÜ K‡i we`y¨r ms‡hvM wew”Qbœ Ki‡Z n‡e|

cÖwµqv AbymiY t Codeblocks md&UIqviwU Pvjy K‡i wb¤œwjwLZ avc¸‡jv AbymiY Kwi-
avc 1t File – New – Empty File wK¬K K‡i bZzb GKwU dvBj Lywj|
avc 2t File – Save file as wK¬K Kwi|

F
avc 3t File name G dvB‡ji bvg w`‡q Ges Save as type C/C++files wm‡j± K‡i Save
evU‡b wK¬K Kwi|

PD
avc 4t wm j¨vs¸‡qR e¨envi K‡i wb‡Pi †KvW ¸‡jv wjwL|
#include<stdio.h>
main()
{
int n,k,sum=0;
te r
printf("Enter your number ");
scanf("%d",&n);
for(k=1;k<=n;k=k+1)
{
as

sum=sum+k*k;
}
printf("The result is %d",sum);
}
nM

avc 5 t Build evU‡b wK¬K K‡i †cÖvMÖvgwU‡K K¤úvBj K‡i wWevwMs Kwi|
avc 6 t Run evU‡b wK¬K K‡i †cÖvMÖvgwU‡K Pvjy K‡i n=100 BbcyU w`B|
avc 7 t Enter evU‡b wK¬K Ki‡j djvdj cvIqv hvq|
di

Enter your number 100


djvdj t The result is 338350
Process returned 20 (0*14) execution time : 8.518 s
a te

Press any key to continue

e¨vL¨v t GB †cÖvMªv‡g e¨eüZ wm j¨vs¸‡q‡Ri †Kv‡Wi e¨vL¨v wb‡¤œ †`qv n‡jv-


* n,k,sum Bw›URvi UvB‡ci †fwi‡qe‡ji Rb¨ int KxIqvW© e¨envi Kiv n‡q‡Q|
re

Page 8
r
i to
* scanf ( ) dvskb e¨envi K‡i n Gi gvb Kx‡ev‡W©i mvnv‡h¨ BbcyU †bqv n‡q‡Q|
* for loop avivi †hvMdj wbY©q Kiv n‡q‡Q |
* Printf ( ) dvskb e¨envi K‡i AvDUcyU cÖ`k©b Kiv n‡q‡Q|

Ed
A¨vjMwi`g
start
avc 1 t start
read n
avc 2 t read n

F
avc 3 tLet sum = 0
sum = 0
avc 4 Let k = 1

PD
avc 5 t Calculate sum = sum + k2 k=1
avc 6 t Calculate k = k + 1
avc 7 t If k<=n goto step 5 sum = sum + k2
avc 8 t print sum
te r
avc 9 t stop ifk k<=n
=+1

True If k<=n
as

False

print sum
nM

stop
di
a te
re

Page 9

You might also like