6790209 Lab Manual Focp

  • Upload
    siachen

  • View
    225

  • Download
    0

Embed Size (px)

Citation preview

  • 8/6/2019 6790209 Lab Manual Focp

    1/68

    SUBJECT CODE: CSE-101-E

    SYLLABUS FOR COMPUTER PROGRAMMING LAB

    1. Program to find Largest of three Numbers.

    2. Program to find largest out of ten numbers.

    3. Program to find largest and second largest out of ten numbers.

    4. Program to add two matrices.

    5. Program to concatenate two Strings.

    6. Program to check whether a string is palindrome or not.

    7. Program to find factorial of a number entered through Keyboard.

    8. Program to swap two numbers.

    9. Program to reverse a number entered through keyboard.

    10. Program to sum digits of a number entered through keyboard.

    11. Program to reverse a string.

    12. Program to check whether a number is prime or not.

    13. Program to implement linear search. 14. Program to Draw Pyramid of stars.

    15. Program to multiply two metrices.

  • 8/6/2019 6790209 Lab Manual Focp

    2/68

    RATIONAL BEHIND COMPUTER PROGRAMMING LAB

    This course will show you how to use the C language to create useful programs.Interactive exercises ranging from simple to challenging will illustrate all the

    important features of the language.

    The course is composed of sections. The first section will introduce the studentto the C programming language, as well as some general programming issues.At the start of this section, the student can verify that he or she meets the

    course prerequisites.

    The second section presents the basic details of the C language as they differfrom those of C++. Following this section is a focus on some advanced languageissues involving functions and memory management. Another section presentsstring manipulation and file I/O along with an overview of C's standardlibraries. Finally, the course concludes with a lesson on building projects fromseveral files, and a comprehensive look at creating useful data structures in C.

    C was created by Dennis M. Ritchie, in 1971 as the successor to the language`B'. The first dialect of C is now called `common C' or `classic C' and differs

    slightly from the new ANSI (American National Standards Institute) C standardwhich was adopted in 1983. C is a very fast and efficient yet flexible languageoften used for programs where speed and developer control are vital. In 1973,the UNIX OS was written almost entirely in C and the language remains closelylinked to this OS. The flexibility of C comes with a price since it does notenforce good style and type checking the way that other high level languages likePascal, BASIC of Java. This means that C is more error prone and more difficultto `debug'. Despite these drawbacks, C was the most widely used programminglanguage during the past three decades and is only now losing favour to objectoriented languages such as C++ and Java

  • 8/6/2019 6790209 Lab Manual Focp

    3/68

    SOFTWARE AND HARDWARE REQUIREMENTS

    SOFTWARE : C LANGUAGE

    OPERATING SYSTEM : ANY

    HARDWARE REQUIREMENT: 50MB RAM, 1GB

    PROCESSOR: 386 AND ABOVE

  • 8/6/2019 6790209 Lab Manual Focp

    4/68

    FLOWCHART TO FIND LARGEST OF THREE NUMBERS

    START

    read a , b , c

    No Yesis a>b and a>c is b>a and b>c

    YesNo

    printLargest of three numbers: a print

    Largest of three numbers: b

    printLargest of three numbers: c

    STOP

  • 8/6/2019 6790209 Lab Manual Focp

    5/68

    ALGORITHM TO FIND LARGEST OF THREE NUMBERS

    1. float a,b,c;2. print Enter any three numbers:;3. read a,b,c;4. if((a>b)&&(a>c))5. print Largest of three numbers:, a;6. else7. if((b>a)&&(b>c))8. print Largest of three numbers:, b;9. else10.print Largest of three numbers:, c;

  • 8/6/2019 6790209 Lab Manual Focp

    6/68

    PROGRAM TO FIND LARGEST OF THREE NUMBERS

    #include#includevoid main( ){float a,b,c;

    printf(Enter any three numbers:);scanf(%f%f%f,&a,&b,&c);if((a>b)&&(a>c)){

    printf(Largest of three numbers: %f,a);}elseif((b>a)&&(b>c)){

    printf(Largest of three numbers: %f,b);}else{

    printf(Largest of three numbers: %f,c);}getch( );}

  • 8/6/2019 6790209 Lab Manual Focp

    7/68

    OUTPUT :

    Enter any three numbers:501450123Largest of three numbers:501

    Enter any three numbers:97.5281.2397.65Largest of three numbers:97.65

  • 8/6/2019 6790209 Lab Manual Focp

    8/68

    FLOWCHART TO FIND LARGEST NUMBER OUT OF TENNUMBERS

    START

    Yes

    i=0 i

  • 8/6/2019 6790209 Lab Manual Focp

    9/68

    ALGORITHM TO FIND LARGEST NUMBER OUT OF TENNUMBERS

    1. integer a[10],i , s=0,j,t;2. print Enter ten numbers:3. Value of i will be incremented by using for loop;4. read a[i];5. Value of iand j will be incremented by using for loop;6. if(a[i]>a[j])7. t 1;8. else9. t 0;10. break;11.if(t==1)12.print Largest no.:,a[i];13.break;

  • 8/6/2019 6790209 Lab Manual Focp

    10/68

    PROGRAM TO FIND LARGEST NUMBER OUT OF TEN NUMBERS

    #include#includevoid main(){int a[10],i,s=0,j,t;clrscr();

    printf(Enter ten numbers:);for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    11/68

    OUTPUT:

    Enter ten numbers: 234591091356633997

    Largest no.: 97

  • 8/6/2019 6790209 Lab Manual Focp

    12/68

    sto

    FLOWCHART TO READ A STRING AND WRITE IT IN REVERSEORDER

    START

    Read array a

    i=0i=0

    Noa[i]!= \0 j=g-1 No

    i

  • 8/6/2019 6790209 Lab Manual Focp

    13/68

    ALGORITHM TO READ A STRING AND WRITE IT IN REVERSEORDER

    1. character a[20],i , b[20],g=0,j;2. print Enter any string:3. read array a;4. Length of the string in the array is calculated by using for loop in g;5. string in array a is reversed in array b by incrementing value of i and

    decrementing value of j by for loop;6. print Reverse order of string:,b;

  • 8/6/2019 6790209 Lab Manual Focp

    14/68

    PROGRAM TO READ A STRING AND WRITE IT IN REVERSE

    ORDER

    #include#includevoid main(){char a[20],i , b[20],g=0,j;clrscr();

    printf("Enter any string: ");

    scanf("%s",a);for(i=0;a[i]!='\0';i++){g++;}

    j=g-1;for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    15/68

    OUTPUT :

    Enter any string: Twinkle

    Reverse order of string: elkniwT

    Enter any string: Arora

    Reverse order of string: arorA

  • 8/6/2019 6790209 Lab Manual Focp

    16/68

    FLOWCHART TOCHECK THAT THE INPUT STRING IS APALINDROME OR NOT

    START

    Read array a

    i=0i=0

    Noa[i]!= \0 j=g-1 Noi

  • 8/6/2019 6790209 Lab Manual Focp

    17/68

    1.

    Yesm=0

    No

    Print m=1String is Palindrome

    PrintString is not Palindrome

    STOP

  • 8/6/2019 6790209 Lab Manual Focp

    18/68

    ALGORITHM TOCHECK THAT THE INPUT STRING IS APALINDROME OR NOT

    1. character a[20],i , b[20],g=0,j,m;2. print Enter any string:3. read array a;4. Length of the string in the array is calculated by using for loop in g;5. string in array a is reversed in array b by incrementing value of i and

    decrementing value of j by for loop;6. print Reverse order of string:,b;7. condition of equality of array a and b is checked by for loop;8. if condition is satisfied then the string is palindrome9. if condition is not satisfied then the string is not palindrome

  • 8/6/2019 6790209 Lab Manual Focp

    19/68

    PROGRAM TOCHECK THAT THE INPUT STRING IS APALINDROME OR NOT

    #include#include#includevoid main(){char a[20],i,b[20],g=0,j,m;clrscr();

    printf("Enter any string: ");scanf("%s",a);for(i=0;a[i]!='\0';i++){g++;

    } j=g-1;for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    20/68

    OUTPUT :

    Enter any string: MadamString is not a Palindrome

    Enter any string: ARORAString is a Palindrome

  • 8/6/2019 6790209 Lab Manual Focp

    21/68

    sto

    FLOWCHART TO CONCATINATE TWO STRINGS

    START

    Print Enter first stringRead a;Print Enter second stringRead b

    i=0

    j=0

    Noa[i]!= \0

    b[j]!= \0Yes

    c[i]=a[i]

    c[i+j]=b[j]

    i++

    j++

    printThe Concatenated string is: c

  • 8/6/2019 6790209 Lab Manual Focp

    22/68

    ALGORITHM TO CONCATINATE TWO STRINGS

    1. character array a[25],b[25],c[25];2. integer i,j;3. print Enter first string:;4. read a;5. print Enter second string:;6. read b;7. string a is copied to array c by using for loop;8. string b is copied to array cnext to the first string by using for loop;9. print The concatenated string is:,c;

  • 8/6/2019 6790209 Lab Manual Focp

    23/68

    WRITE A PROGRAM TO CONCATINATE TWO STRINGS

    #include#includevoid main(){char a[25],b[25],c[25];int i.j;clrscr();

    printf(Enter first string:);scanf(%s,a);

    printf(Enter second string:);scanf(%s,b);for(i=0;a[i]!=\0;i++)

    c[i]=a[i];for(j=0; b[j]!=\0; j++)c[i+j]=b[j];c[i+j]=\0;

    printf(The concatenated string is:\n%s,c);getch();

    }

  • 8/6/2019 6790209 Lab Manual Focp

    24/68

    OUTPUT :

    Enter first string: NetEnter second string: World

    The concatenated string is: NetWorld

  • 8/6/2019 6790209 Lab Manual Focp

    25/68

    FLOWCHART TO MULTIPLY TWO MATRICES

    START

    read m,n,p,q;

    n=p i=0 i=0 j=0 j=0

    No NoPrint i

  • 8/6/2019 6790209 Lab Manual Focp

    26/68

    1.

    i=0 j=0

    i

  • 8/6/2019 6790209 Lab Manual Focp

    27/68

    ALGORITHM TO MULTIPLY TWO MATRICES

    1. integer array a[10][10],b[10][10],c[10][10];2. integer i, j, m, n, p, q, s;3. print Input row and column of matrix-A;

    4. read m, n;5. print Input row and column of matrix-B;6. read p, q;7. if n not equals to p8. print Matrix cannot be multiplied;9. else10.print Input matrix-A;11.read the input by using two for loop, one for row and other for column of matrix12.print Input matrix-B;13.read the input by using two for loop, one for row and other for column of matrix14.multiplication is done by using three for loops incrementing i, j, s where

    iis for row and j is for column of array15.c[i][j]=c[i][j]+a[i][s]*b[s][j];16.print Product of matrix A and matrix B is:17.print array c in which multiplication of two arrays are stored using for loops

    WRITE A PROGRAM TO MULTIPLY TWO MATRICES

  • 8/6/2019 6790209 Lab Manual Focp

    28/68

    #include#include#includevoid main(){int a[10][10],b[10][10],c[10][10];int i,j,m,n,p,q,s;clrscr();

    printf("Input row and column of matrix-A\n");scanf("%d%d",&m,&n);

    printf("Input row and column of matrix-B\n");scanf("%d%d",&p,&q);if(n!=p){

    printf("Matrix cannot be multiplied\n");

    getch();exit(0);}

    printf("Input Matrix-A\n");for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    29/68

    } printf("\nProduct of matrix A and matrix B is:\n");for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    30/68

    OUTPUT:Input row and column of matrix-A

    3

    4Input row and column of matrix-B24Matrix cannot be multiplied

    Input row and column of matrix-A22Input row and column of matrix-B24Input Matrix-A1234556Input Matrix-B74

    23147146263911534Product of matrix A and matrix B is:

    702 681 579 1707840 690 1510 1946

  • 8/6/2019 6790209 Lab Manual Focp

    31/68

    sto

    FLOWCHART TO SOLVE QUADRATIC EQUATION

    START

    Read a,b,c

    Quad(a,b,c);

    A

    d=(b 2)-(4*a*c)

    Yes Is No is Yesd

  • 8/6/2019 6790209 Lab Manual Focp

    32/68

    ALGORITHM TO SOLVE QUADRATIC EQUATION

    1. integer a,b,c;2. float d,r1,r2,r3,r4,r;3. print Enter values of a,b,c of a quadratic equation:;4. read a,b,c;5. value of a,b,c is transferred to function quadand body of function is:6. d b x b-4 x a x c;7. if(d

  • 8/6/2019 6790209 Lab Manual Focp

    33/68

    WRITE A PROGRAM TO SOLVE QUADRATIC EQUATION

    #include#include

    #includevoid main(){void quad(int a, int b ,int c);int a,b,c;float r;clrscr();

    printf(Enter values of a,b,c of a quadratic equation:\n );scanf(%d%d%d,&a,&b,&c);quad(a,b,c);getch();}

    void quad(int a, int b ,int c){float d,r1,r2,r3,r4,r;d=(b*b)-(4*a*c);switch(d){

    case

  • 8/6/2019 6790209 Lab Manual Focp

    34/68

    OUTPUT:

    Enter values of a,b,c of a quadratic equation: 224

    Value of Discriminant is negative

    Enter values of a,b,c of a quadratic equation: 152

    First root of equation: -2.9384Second root of equation: -7.0615

    Enter values of a,b,c of a quadratic equation: 242Roots are realFirst and Second root of equation: -1

  • 8/6/2019 6790209 Lab Manual Focp

    35/68

    FLOWCHART TO FIND LARGEST AND SECOND LARGESTNUMBER OUT OF GIVEN NUMBER

    START

    printHow many no. will you enter:

    Read ni=0

    Noi

  • 8/6/2019 6790209 Lab Manual Focp

    36/68

    1

    sl=a[1] i=0

    isl

    a[i]=l

    i++ sl=a[i]

    print

    Second largest no. is:sl

    STOP

  • 8/6/2019 6790209 Lab Manual Focp

    37/68

    ALGORITHM TO FIND LARGEST AND SECOND LARGESTNUMBER OUT OF GIVEN NUMBER

    1. integer i,a[55],n,l=0,sl;2. print"How many no. will you enter: ";3. read n4. values will be entered in array a by using for loop5. l=a[1]6. by using for loop and incrementing value of i a[i] is checked for largest no. with

    l(a[i]>l)7. the largest value is stored in l and printed8. print "Largest element is:",l;9. again the above process is continued but if a[i]equals to largest value l then

    value of i is incremented and second largest value is stored in sl10.print "Second Largest element is:",sl;

  • 8/6/2019 6790209 Lab Manual Focp

    38/68

    WRITE A PROGRAM TO FIND LARGEST AND SECONDLARGEST NUMBER OUT OF GIVEN NUMBER

    #include#include

    void main(){int i,a[55],n,l=0,sl;clrscr();

    printf("How many no. will you enter: ");scanf("%d",&n);for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    39/68

    OUTPUT:How many no. will you enter:10Enter numbers

    20411570903520552816

    Largest element is: 90Second Largest element is: 70

  • 8/6/2019 6790209 Lab Manual Focp

    40/68

    ALGORITHM TO FIND WHETHER A NUMBER IS PRIME OR NOT

    1. Declare two integer values I & n and initialize third integer value.

    2. Initialize I as zero and give condition as I = n/2

    3. If n%2 = 0 then f = 1.

    4. Now if f = = 1 the number is not a prime number else it is prime

  • 8/6/2019 6790209 Lab Manual Focp

    41/68

    WRITE A PROGRAM TO CHECK THAT INPUT NUMBER ISPRIME OR NOT

    #include#include

    void main( ){int num, i;clrscr( ) ;

    printf(\n enter a no.) ;scanf(%d, & num) ;i=2 ;While(I

  • 8/6/2019 6790209 Lab Manual Focp

    42/68

    OUTPUT :

    Enter a number : 3Prime number

    Enter a number : 9 Not a Prime number

  • 8/6/2019 6790209 Lab Manual Focp

    43/68

    ALGORITHM TO FIND THE MALE AND FEMALEAVERAGE HEIGHT

    STEP 1 : Declare the variable i,mh,fh as integer value and mavg,favg,msum,fsum as floatvalue.

    STEP 2: Input height of male.

    STEP 3: Calculate sum and then average of height of females.

    STEP 4: Input height of female.

    STEP 5:. Calculate sum and then average of height of females.

    STEP 6: Stop

  • 8/6/2019 6790209 Lab Manual Focp

    44/68

    WRITE A PROGRAM TO FIND AVERAGE OF MALE &FEMALE HEIGHT IN THE CLASS

    #include

    #includevoid main(){int mh[5],fh[5],i;float mavg,favg,msum=0,fsum=0;clrscr();

    printf(enter the height of male\n);for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    45/68

    OUTPUT:

    enter the height of male2022252423enter the height of female

    2220212322

    the average of male height is 22.8

    the average of female height is 21.6

  • 8/6/2019 6790209 Lab Manual Focp

    46/68

    ALGORITHM TO FIND THE FACTORIAL OF APARTICULAR NUMBER

    STEP 1 : Declare the int variable a,i,fact=1.

    STEP 2: input the number in a.

    STEP 3: After for loop fact =fact*i

    STEP 4 : print the factorial number in fact.

    STEP 5. Stop.

    -

  • 8/6/2019 6790209 Lab Manual Focp

    47/68

    WRITE A PROGRAM TO FIND FACTORIAL OF A NUMBER

    #include#includevoid main(){int a,i.fact=1;clrscr();

    printf(Enter the number \n);scanf(%d%,&a);

    for(i=1;i

  • 8/6/2019 6790209 Lab Manual Focp

    48/68

    OUTPUT:

    Enter the number

    6

    the factorial is720

  • 8/6/2019 6790209 Lab Manual Focp

    49/68

    ALGORITHM TO PRINT THE FIBONACCI SERIES

    STEP 1 : Declare the int variable f,s,n,c,t.STEP 2: declare f=1,s=1.

    STEP 3: After for loop t=f+s.

    STEP 4 :print the result in t.

    STEP 5 : f=s, s=t.

    STEP 6. Stop.

    -

  • 8/6/2019 6790209 Lab Manual Focp

    50/68

    WRITE A PROGRAM TO PRINT FIBONACCI SERIES

    #include#includevoid main(){

    int f,s,n,c,t;clrscr(); printf(Enter the number of series \n);scanf(%d,&n);f=1;s=1;

    printf(%d\t,f); printf(%d\t,s);for(c=1;c

  • 8/6/2019 6790209 Lab Manual Focp

    51/68

    OUTPUT:

    Enter the number of series6

    1 1 2 3 5 8

  • 8/6/2019 6790209 Lab Manual Focp

    52/68

    ALGORITHM TO FIND THE REVERSE OF A NUMBER

    STEP 1 : Declare the int variable n,b,s=0

    STEP 2: enter the number in n (which can be reverse).

    STEP 3: using while loop(n!=0)

    STEP 4 : b=n%10s=(s*10)+bn=n/10

    STEP 5 : print the reverse number in s.

    STEP 6. Stop.

    -

  • 8/6/2019 6790209 Lab Manual Focp

    53/68

    WRITE A PROGRAM TO REVERSE OF NUMBER

    #include#includevoid main(){int n,b,s=0;clrscr();

    printf(Enter the number \n);scanf(%d,&n);while(n!=0){

    b=n%10;s=(s*10)+b;n=n/10;}

    printf(The reverse number is %d,s);getch();}

  • 8/6/2019 6790209 Lab Manual Focp

    54/68

    OUTPUT:

    Enter the number 123

    The reverse number is321

  • 8/6/2019 6790209 Lab Manual Focp

    55/68

    ALGORITEM TO SWAP TWO NUMBERS

    STEP 1 : Declare the int variable a,b,temp.

    STEP 2: enter the number in a &b.

    STEP 3: temp=aa=bb=temp

    STEP 4 : print the swapped value in a,b.

    STEP 5. Stop.

    -

  • 8/6/2019 6790209 Lab Manual Focp

    56/68

    WRITE A PROGRAM TO SWAP OF TWO NUMBER

    #include#includevoid main(){int a,,b,temp;clrscr();

    printf(Enter the number of a&b \n);scanf(%d\n%d\n,&a,&b);temp=a;a=b;

    b=temp; printf(the swapped values are \n); printf(%d\n%d\n,a,b);getch();}

  • 8/6/2019 6790209 Lab Manual Focp

    57/68

    OUTPUT:

    Enter the number of a&b48

    the swapped values are84

  • 8/6/2019 6790209 Lab Manual Focp

    58/68

    ALGORITHM TO PRINT PYRAMIND OF STARS

    STEP 1 : Declare the int variable i.a.j.k

    STEP 2: enter the number of line in a.

    STEP 3: using for loop i is compare when it is not equal to and less than a.j is initialize for blank space.k is initialize to print the star.

    STEP 4. Stop.

    -

  • 8/6/2019 6790209 Lab Manual Focp

    59/68

    WRITE A PROGRAM TO PRINT PYRAMID STAR

    #include#includevoid main(){int i,a,j,k;clrscr();

    printf(enter the number of line \n);scanf(%d,&a);for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    60/68

    OUTPUT:

    enter the number of line5

    ****

    ************

    *********

  • 8/6/2019 6790209 Lab Manual Focp

    61/68

    ALGORITHM TO PRINT THE SUM OF TWO MATRICES

    STEP 1 : Declare two dimensional array a,b,c and int variable i,j,k,r1,r2,c1,c2.

    STEP 2: Input the order of matrix a& b.

    STEP 3: using for loop i,j, enter the element of matrix a in a[i][j]using for loop i,j, enter the element of matrix b in b[i][j].

    STEP 4 : c[i][j]=a[i][j]+b[i][j]

    STEP 5 : print the addition of two matrices in c[i][j].

    STEP 6. Stop

  • 8/6/2019 6790209 Lab Manual Focp

    62/68

    WRITE A PROGRAM TO SUM OF TWO MATRICES

    #include#includevoid main(){int a[10][10],b[10][10],c[10][10];int i,j,k,r1,r2,c1,c2;clrscr();

    printf("input the order of matrix A:");scanf("%d%d",&r1,&c1);

    printf("input the order of matrix B:");scanf("%d%d",&r2,&c2);

    printf("enter the element of matrix A(row wise) \n");for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    63/68

    printf("the element of matrix B is \n");for(i=0;i

  • 8/6/2019 6790209 Lab Manual Focp

    64/68

    OUTPUT:

    input the order of matrix A:

    22input the order of matrix B:22

    enter the element of matrix A(row wise)3679enter the element of matrix B(row wise)4628

    the element of matrix A is

    3 67 9

    the element of matrix B is4 62 8

    the addition of matrix is :

    7 129 17

  • 8/6/2019 6790209 Lab Manual Focp

    65/68

    New ideas/ experiments required for Computer programming labbehind university syllabus

  • 8/6/2019 6790209 Lab Manual Focp

    66/68

    1. LIST OF FREQUENTLY ASKED QUESTIONS

    How do you decide which integer type to use?

    What should the 64-bit type on new, 64-bit machines be?

    What can I safely assume about the initial values of variables whichare not explicitly initialized? If global variables start out as ``zero,''is that good enough for null pointers and floating-point zeroes?

    How can I read a single character from the keyboard withoutwaiting for a newline

    How can I copy a float into a string?

    Why doesn't C have an exponentiation operator?

    Why does everyone say not to use gets()?

    Why doesn't the code a[i] = i++; work?

    How does struct passing and returning work?

    Why can't you compare structs?

    How do I enter values using hexadecimal?

    What does extern mean in a function declaration?

    How do I ``get'' a null statement in my programs?

    Is there more than one null statement?

    Is a null statement a null pointer?

  • 8/6/2019 6790209 Lab Manual Focp

    67/68

    I had the definition char a[6] in one source file, and in another Ideclared extern char a[] . Why did it work?

    why are array and pointer declarations interchangeable as functionformal parameters?

    what is the difference between arrays and pointers?

    How does free() know how many bytes to free?

    How can I get the numeric (character set) value corresponding to acharacter, or vice versa?

    What is the right type to use for boolean values in C? Why isn't it astandard type? Should #define s or enum s be used for the true and falsevalues?

    What is the ``ANSI C Standard?''

    What's the difference between ``char const *p'' and ``char * constp''?

    What's wrong with this code:

    char c; while((c = getchar()) != EOF)...

    How can I print a ``%'' character in a printf format string?

    Which is larger, ``2'' or ``2.0''?

  • 8/6/2019 6790209 Lab Manual Focp

    68/68