We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
ieene i
re te ee ell ar ar
nee ee ee esa Le ee a ras
Pst ee CAE
Paulo ned
Career aCe Ene
Lees
PR ria tae
anes aes
Ge acy
PGS Con es US ate)
Gey)
printt("Please,enter your year of birth:
Grau a
aCe nec
etek Uae os
printt("Your age is: %d years.", Age)3\
Cesta
Er
Sane ees saree
Sree et ent at]
een a cea ares LT
eeeCreated Tes
re Oe Te ne el er etry
a ee ee eee ee se ee ee ces
pester
Prarcsurone
crete
char Name[ 10]
eae
eee ete
Ge on
qo ee Cay
ni é Pu
PG SC eC eT a oy
Gy}
Perea een et To
: > Name)
rn ee years.", Age);\
et
input
Perera
reenter
enter your year
ea ee
eeeRea a
re ee Ten al ee et
Write your code in this editor and press "Run" button to compile and execute it
Pets Cees Cees
Prac uo ne
Pers
Soe oie
Serres
Pees ec Le
Rega sae Saga stor
pe
}
input
a ee
See ee cee
Press
Ee eeearrears
Oc ea ee ee a ey erat
Nee ee Cet a ee a sc aes seen ea es
#include
Frac uOnt
eta ema
DeGcmrta
ec
Seu
erences eee oy
eects eel
eegeia ss setts car eee
carry
aeusze
pote
Paka CC Rea oC eo)
CeaHere is an explanation of the cole
‘he eineiude cstato.t> directive tells the compiler te incluce the standard input/output header File which contains functions like printf(), scanf() ete
nk main) = This declares the mtin function which is the starting point of any € progra.
const Ant CucrantVear = 2026; - The declares « constant integer vardabie Curvertvear and nitianizes {8 to 2020
char Wane{10]; = Declares 2 character array Wane that can store up to 18 characters to hold the user's rane
ne vearorbiet, Age; - Declares two Integer variables, YearofBirth to held the user's year of Birth and Age to held thelr calculated age
printf ("pLeaze,enter your first nape:
= Prints the pronpt asking for the user's name
seanf(%s", ane); - Reads a string fram stdin and stores it in the Nane array
princt("Please,enter your year of birth: "); + Promts user for their year of birth
seant("%a", Avearofeireny; - Reads an Lnteger fron stein and stores 4€ An Yearofairen verdabie
‘ge = CunrentVaar - YearofEsrth; - Calculates the age by subtracting your of birth fron current yet
rintt("Your name: $5\0", Hane); ~ Prints te user's ane
printt("Your age £2: Ad years.", Hge)s ~ Prints the calculates eee.
return 0; ~ Returns @ to the 05, indicating successful execution
‘he second code calculates s waskly pay. Te declaces variables to hold the number of work days, hours worked, pay eate and cneulated weekly pay
Drints the tina nelly Pa
in Atfelse statenent altoes conditional execution of code based on sone condition being true or false. It allows executing one block of cole AF the