C Program to Print Table of a Given Number

download C Program to Print Table of a Given Number

of 9

Transcript of C Program to Print Table of a Given Number

  • 7/23/2019 C Program to Print Table of a Given Number

    1/9

    C program to print

    table

    of a given number

    #include

    #include

    void main()

    {

    int i,n;

    clrscr(); //to clear the screen

    printf(Enter any numer!");

    scanf(d",$n);

    printf(%ale of d is!n",n);

    for(i&';i

  • 7/23/2019 C Program to Print Table of a Given Number

    2/9

    un the pro+ram usin+ 0trl12

    Output:

    Enter any numer! 8

    8 * ' & 88 * 4 & '6

    8 * 5 & 4'8 * 6 & 49

    8 * 3 &538 * 7 & 64

    8 * 8 & 62

    8 * 9 & 378 * 2 & 75* $ 1+ = *+

    Write a VB program toaccept the number

    fromthe user in text boxanddisplay multiplicationtable of that numberinto the list box.

    :rivate u cmd0lear0lic=()

    %et'.%et & "?ist'.0lear%et'.et1ocus

    End u

    :rivate u cmd@isplay0lic=()

    @im n, i As Bnte+ern & Cal(%et'.%et)

    1or i & ' %o '

    ?ist'.AddBtem n * i

    Det

    End u

    :rivate u cmdEit0lic=()

    nload FeEnd u

    :rivate u 1orm?oad()

    ?ist'.0lear

    End u

    Write a program in for loop to

    show

    multiplication table of a given

    number

    using S,stem-

    using S,stem.Colletions.eneri-

    using S,stem.Lin/-

    using S,stem.#e!t-

    names0ae stringCont

    lass 'rogram

    stati 2oi& Main(string34 args)

    Console.WriteLine(%nter Number ton& Multi0liation)-

    int num =Con2ert.#oInt67(Console.ea&Line())-

    8or (int i = 1- i

  • 7/23/2019 C Program to Print Table of a Given Number

    3/9

    '+ total&arks , - /0en&s"Bo(23assed 2# !lse&s"Bo(2Failed 2#

    !nd Sub

    !nd Class

    'rint mar:;sheet o8 stu&ents

    45 Print t0e &arkss0eet o+ Students o+ BA Final 6ear5445 variable descri3tion rl 7, 8oll 9o s1 7, Subject1 &arks s: 7, Subject: &arks s) 7, Subject) &arks t 7, total 3er 7, 3ercenta"e nm 7, name o+ student div 7, division 5445 linkin" section 54;include scan+(2d2rl#> 3rint+(2!nter 9ame 2#> ++lus0(stdin#> "ets(nm#> 3rint+(2!nter /0ree Subject &arks Dn2#> scan+(2ddd2s1s:s)#> 45 3rocessin" 3art 54 ts1Es:Es)> 3ert4).> i+(3er,-# strc3y(div2$onour2#> else i+( 3er,G#

    strc3y(div2First2#>else i+( 3er,HI#

    strc3y(div2Second2#> else i+ (3er,)G#

    strc3y(div2Pass2#> else strc3y(div2Fail2#>

  • 7/23/2019 C Program to Print Table of a Given Number

    4/9

    45 dis3lay 3art 54 3rint+(2DtDtJniversity o+ 8ajast0anDn2#> 3rint+(2DnDn2#> 3rint+(28oll 9o d Dt 9ame sDn2rlnm#>3rint+(2777777777777777777777777777777777777777777777777777Dn2#> 3rint+(2Subject &a &in

    Obt.&arksDn2#>3rint+(2777777777777777777777777777777777777777777777777777Dn2#> 3rint+(2$ist 1 )GdDn2s1#>

    3rint+(2socio. 1 )GdDn2s:#>

    3rint+(2$indi 1 )GdDn2s)#>

    3rint+(2777777777777777777777777777777777777777777777777777Dn2#> 3rint+(2 /otaldDn2t#>

    3rint+(23er +DtDtDt div s Dn23erdiv#>

    3rint+(2777777777777777777777777777777777777777777777777777Dn2#>

    "etc0(#>KC 'rogram to enerate the Mar:sheet o8 the Stu&ent

    #his C 'rogram enerates the Mar:sheet o8 the Stu&ent. ere the stu&ent &etailsare obtaine& 8rom the user an& the mar:sheet is generate& base& on the &etails.

    Gere is source code of the 0# :ro+ram to Henerate the Far=sheet of the tudent. %he 0#

    pro+ram is successfully compiled and eecuted Iith Ficrosoft Cisual tudio. %he pro+ram

    output is also shoIn eloI.

    1. 45

    :. 5 C; Pro"ram to Lenerate t0e &arks0eet o+ t0e Student). 54H. usin" System>-. usin" System.Collections.Leneric>G. usin" System.MinN>. usin" System./et>I.*. names3ace &arks0eet11. =11. class Pro"ram1:. =1). static void &ain(strin"?@ ar"s#1H. =

    1-. int r m1 m: m) t>

  • 7/23/2019 C Program to Print Table of a Given Number

    5/9

    1G. +loat 3>1. strin" n>1I. Console.riteMine(2!nter 8oll 9umber 2#>1*. r Convert./o'nt):(Console.8eadMine(##>:. Console.riteMine(2!nter Student 9ame 2#>:1. n Console.8eadMine(#>::. Console.riteMine(2&ark o+ Subject1 2#>:). m1 Convert./o'nt):(Console.8eadMine(##>:H. Console.riteMine(2&ark o+ Subject: 2#>:-. m: Convert./o'nt):(Console.8eadMine(##>:G. Console.riteMine(2&ark o+ Subject) 2#>

    :. m) Convert./o'nt):(Console.8eadMine(##>:I. t m1 E m: E m)>:*. 3 t 4 ).+>). Console.riteMine(2/otal 2 E t#>)1. Console.riteMine(2Percenta"e 2 E 3#>):. i+ (3 , )- 3 < -#)). =)H. Console.riteMine(2Lrade is C2#>)-. K)G. i+ (3 , - 3 )*. K

    H. i+ (3 , G 3 H). KHH. i+ (3 , I 3 H. KHI. Console.8eadMine(#>H*. K-. K-1. K

    Gere is the output of the 0# :ro+ram!

    !nter 8oll9umber HI!nter Student 9ame sri&ark o+ Subject1 *&ark o+ Subject: I&ark o+ Subject) /otal :HPercenta"e ILrade is A

    C-program (sequence) Mark sheet15. Write a Program to input name, class and marks in fie !u"#ects like

    $nglish, math, %epali, account, Computer science &ind 'otal, percentage,

    diision, remarks 'he condition of diision is..: Percentage / Division: per> =

    75 / Distinction, per> = 60 AND per = 45 AND per = 5 AND per

  • 7/23/2019 C Program to Print Table of a Given Number

    6/9

    (inc$)de = 5 acc> = 5 cscience> = 5

    print1 +29 n;e*ars: PASS3D2

    e$seprint1 +29 n;e*ars: FA3D2

    i1 +per> = 75

    print1 +2Division: Distnction2

    e$se i1 +per> = 60 per = 45 per = 5 per

  • 7/23/2019 C Program to Print Table of a Given Number

    7/9

    the Select Casecontrol structure. GoIever, the elect 0ase control structure is sli+htly different

    from the Bf....ElseBf control structure .

    %he difference is that theSelect Casecontrol structure can handle conditions Iith multiple

    outcomes in an easier manner than the If...Then...ElseIf control structure. If...Then...ElseIf

    control structure asically used to handle a sin+le condition havin+ more than tIo outcomes.

    %hou+h If...Then...ElseIfcontrol structure may also e used compute conditions Iith multiple

    outcomes, Ie need to use more than tIo levels of nested If...Then...ElseIf statements, this can

    ma=e it difficult to read the codes. %herefore, the Select Case control structure is preferred Ihen

    there eist many different conditions.

    %he format of the elect 0ase control structure is shoI eloI!

    elect 0ase epression

    0asevalue'

    Jloc= of one or more CJ statements

    0asevalue4

    Jloc= of one or more CJ tatements

    0asevalue5

    ..

    0aseElse

    Jloc= of one or more CJ tatements

    3nd Se$ect

    Example 8.1

    Dim gra&e As String'ri2ate Sub Com0ute>Cli:( )gra&e=t!tgra&e.#e!t

    Selet Case gra&e Case A

    result.Ca0tion=igh DistintionCase A;

    result.Ca0tion=DistintionCase ?

    result.Ca0tion=Cre&itCase C

    result.Ca0tion='assCase %lse

    result.Ca0tion=@ail%n& Selet

    %n& Sub

    Example 8.2

    Dim mar: As Single

    'ri2ate Sub Com0ute>Cli:()%!amination Mar:smar: = mr:.#e!t

    Selet Case mar:

  • 7/23/2019 C Program to Print Table of a Given Number

    8/9

    Case Is B= 5

    omment.Ca0tion = %!elleneCase Is B= *+

    omment.Ca0tion = oo&

    Case Is B= +omment.Ca0tion = Abo2e A2erage

    Case Is B= 5+omment.Ca0tion = A2erageCase %lseomment.Ca0tion = Nee& to Eor: har&er%n& Selet%n& Sub

    Example 8.3

    Eample 9.4 can e reIritten as folloIs!

    Dim mar: As Single'ri2ate Sub Com0ute>Cli:()%!amination Mar:s

    mar: = mr:.#e!t

    Selet Case mar:Case + to FGomment.Ca0tion = Nee& to Eor: har&erCase 5+ to 5GBH0Bomment.Ca0tion = A2erageCase + to Gomment.Ca0tion = Abo2e A2erageCase *+ to Fomment.Ca0tion = oo&Case %lse

    omment.Ca0tion = %!ellene%n& Selet%n& Sub

    W! to Find Factorial of a "umber #sing $ecursion FunctionW! to Count "umber of Vowels in a %tringW! to Find the "umber is !ositive or "egative #sing Friend Function

    &ownload Files from %cribd for FreeAs Ee all :noE Eell about Srib& Ehih is 0robabl, the best site to get some &ouments.

    #hough there are man, other sites Ehere one an 2ieE or &oEnloa& &ouments 8or 8ree. e!;EEE.bru0t.om EEE.sli&eshare.netet.

    Its not neessar, that Ee get our &esire& le on 8ree sites an& as Srib& is either 0ai& or ,ouha2e to u0loa& a &oument to &oEnloa& one. ?e8ore going ahea& let me share m, oEne!0eriene.Its been a hell o8 a &a, loo:ing 8or some use8ul &oument to 0re0are m, ollege 0roJet an&

    a8ter going through man, 8ree sites I en&e& u0 nothing in m, han& so &ei&e& to oogleabout oE to &oEnloa& les 8ree 8rom EEE.srib&.om. Again the result Eas same most o8the sites as:e& me to install a so8tEare or an e!tension but none o8 them Eor:e& so nall, Iha& to u0loa& one le to &oEnloa& one le 8rom Srib&.

    It Eas o: Eith me until I ha& to get 7;6 les but m, re/uirement Eas o8 75;6+ les noE the0roblem starte& as I Easnt rea&, to u0loa& m, 0reious &ouments on srib& or e2en toEaste m, time u0loa&ing an& lling &etails 8or &oument an& then &oEnloa& the &esire& le.

    A8ter u0loa&ing m, rst &oument Ehen I starte& &oEnloa&ing the le that Eas Ehere I saE

    http://www.brupt.com/http://www.slideshare.ne/http://var/www/apps/conversion/tmp/scratch_1/http:%2F%2F.net%2Fhttp://www.scribd.com/http://www.slideshare.ne/http://www.scribd.com/http://www.brupt.com/http://var/www/apps/conversion/tmp/scratch_1/http:%2F%2F.net%2F
  • 7/23/2019 C Program to Print Table of a Given Number

    9/9

    hoE to &oEnloa& 8or 8ree Eithout an, u0loa& Ehih Eas 2er, sim0le an& Eor:e& e2er, timeEith me.ere am going to share hoE it all Eor:s

    1.Login 8rom ,our 8aeboo: aount7. Searh the le an& o0en it.6. Loo: at the a&&ress bar there ,ou Eill something li:e this( htt0KHHEEE.srib&.omH&oH6*5G+Hin&igee:;blogs )F. NoE Just 0ut 'download at the en& an& 0ress enter or go.

    5. our &oEnloa& starts.

    In an, ase i8 the abo2e 0roe&ure &oesnt Eor:s then ,ou an tr, this 0roessK

    1)Go to scribd.com, search for the document you want and open it.

    2)Right-click anywhere on the page and clickview page source.

    3)Search foraccess_key, once you find it copy it to some place. (Press ctrl-f and type

    access_key,you will find this kind of key2access_key22key71555z9ggumh3nb977n97 the

    highlighted part is access key)

    4)Get thedocument idof the documents that you want to download. Document ID is written in the

    URL of document.5)Replace access_key and document id in this url

    http://d1.scribdassets.com/ScribdViewer.swf?document_id=108992419&access_key=key-

    13davbcdewnewn9m5w02

    And paste the modified url in a new browser window.Once the file appears, you can download it, if

    the download option does not appears then click print option and save it as pdf or onenote file.