Assignment Questions

ASSIGNMENT ON C PROGRAMMING

1.   Interpreter converts ______ level program to machine language program.
2. The ______ expression evaluates the operand on the right side of the operator and places its value in the        variable on the left side of the operator.
3.  The _______ logical operator is true only when both operands are true.
4.   Why high level language is called machine independent language?
5.    What is a flow chart? List any four shaped boxes used in it?
6.    Explain the use of “break” statement with the help of an example.
7. Write a C program to generate the multiplication table of integers. Use formats clearly.   
8. Write a C program to swap (exchange) the values of variables A and B without using any other temporary variable.
9. Using functions, write a C program to determine and print the factorials of all integers from 1 to N.
10.   Write a short note on loop constructs in C language.

Note: submit on 18th Jan 2016.

Assignment 

1.    Explain nested loops with necessary examples.
2.    Explain the advantages in using functions in user programs?
3.    Explain what are decision making statements?
4.    Explain the working of break statement in C.
5.    Explain necessary example the need of an algorithm.
6.    Explain data types in C . Write syntax and examples for each.
7.    Distinguish while and do while statements. Write syntax and example for both.
8.  Write a C program to find the sum of single digit numbers in a given set of numbers.
9.   Differentiate between built-in and user-defined function with necessary examples?
10. Write a program using a function to swap two numbers.


Try To Solve the following.....

Q1.Write a program to find the count of each element in a set of n numbers? 

New Qn:

Q2. Write a program to round a number to nearest decimal place?
       Ex: 17 as 20, 52 as 50.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Solution for Q.1
    void main()
    {
    int r,n,i,t,a[25],c=0;
    printf("Enter Range\n");
    scanf("%d",&n);
    printf("Enter Array Element\n");
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
    if(a[i]==0) c++;
    }
    printf("The count of 0 is %d\n",c);
    c=0;
    for(r=0;r<n;r++)
    {
    t=a[r];
    c=0;
    for(i=0;i<n;i++)
    {
    if(t==a[i])
    {
    c++;
    a[i]=0;
    }
    }
    if(t!=0) printf("The count of %d is %d\n",t,c);
    }
    }

    OUTPUT:

    Enter Range
    10
    9 0 1 2 0 3 1 1 0 9
    The count of 0 is 3
    The count of 9 is 2
    The count of 1 is 3
    The count of 2 is 1
    The count of 3 is 1

    //here numbers once counted are reset as zero; so that they are not again considered.

    ReplyDelete