C Programming 2074

Tribhuwan University
Institute of Science and Technology
2074
Bachelor Level / First Semester / Science
Computer Science and Information Technology ( CSC110 )
( C Programming )
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Attempt any two questions:

1. Discuss structure of a C Program with suitable example.
10 marks view

2. Discuss different types of if statements with example of each. Differentiate if statement with switch statement.

10 marks view

3. What is structure? How is it different from array? Create a structure student having data members name, roll-number and percentage. Complete the program to display the name of student having percentage greater than or equal to 60.

10 marks view

Attempt any eight questions:

4. What is algorithm? How is it different from flow chart?

5 marks view

5. What is type conversion? Discuss type casting with suitable example.

5 marks view

6. Discuss increment and decrement operators with example.

5 marks view

7. Write a program that computes the sum of digits of a given integer number. 

5 marks view

8. What is function? Discuss the benefits of using function.

5 marks view

9. Write a program to find sum and average of 10 integer numbers stored in an array.

5 marks view
Answered by Puja Lakhe.CSIT 1st sem,BMC

#include<stdio.h>

int main()
{
   int array[50],i,n=10,sum=0;
   float avg;
   //printf(" you want to sum and avg of how namy numbers?\\n");
   //scanf("%d",&n);this is for N numbers
   for(i=0;i<n;i++)
   {
    printf("enter the numbers=");
    scanf("%d",&array[i]);
   }
    for(i=0;i<n;i++)
    {
       sum=sum+array[i];
     }
   
   printf("the sum of 10 numbers you entered is=%d\\n",sum);
   avg=(float)sum/n;
   printf("the avg of the 10 numbers you entered is=%f\\n",avg);
   return 0;    
}

10. Define pointer. Discuss the relationship between pointer and one-dimensional array.

5 marks view

11. Write a program to read and print data stored in a file input.txt.

5 marks view

12. Why do we need graphics functions? Write a program to draw a circle.

5 marks view