Tag: BIM 2nd sem
DCCN 2019 Solution
Group B Group C
Continue ReadingDCCN 2017 Solution
2018 1.Why there is bandwidth wastage in FDM? 2018 Ans: Due to the use of guard band in FDM, there is a bandwidth wastage as it uses the bandwidth of FDM. 2.Which layer is responsible for name recognition and security? 2018 Ans: For name recognition and security application layer and presentation layer are responsible […]
Continue Readingc programming 2018 Makeup
Year 2018 Makeup Write a program to print transpose of a given matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#include<stdio.h> void main() { int r,c; printf("Enter the size of the matrix: "); scanf("%d%d",&r,&c); int a[r][c], t[c][r]; int i,j; printf("Enter the elements of the matrix:\n"); //Inputting the elements of the matrix for( i = 0 ; i < r ; i++ ) { for( j = 0 ; j < c ; j++) { printf("Enter [%d][%d] element: ",i,j); scanf("%d",&a[i][j]); } } printf("Given matrix:\n"); //Displaying the elements of the matrix for( i = 0 ; i < r ; i++ ) { for( j = 0 ; j < c ; j++) printf("\t%d",a[i][j]); printf("\n"); } //Calculating transpose of the matrix for( i = 0 ; i < c ; i++ ) for( j = 0 ; j < r ; j++) t[i][j] = a[j][i]; printf("Transpose of the given matrix:\n"); //Displaying the elements of the transpose matrix for( i = 0 ; i < c ; i++ ) { for( j = 0 ; j < r ; j++) printf("\t%d",t[i][j]); printf("\n"); } } |
Write a C program to read the file “hello.txt” and count the number of characters written in this file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<stdio.h> void main() { FILE *f = fopen("hello.txt","r"); int count = 0; if(f) { int c; while((c=fgetc(f))!=EOF) count++; printf("Number of characters in the file 'hello.txt': %d.",count); } else printf("Error reading the file 'hello.txt'."); fclose(f); } |
Write a function to calculate the factorial value of the given number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include<stdio.h> int fact(int n) { if(n<2) return 1; return n*fact(n-1); } void main() { int n; printf("Enter a number: "); scanf("%d",&n); printf("Factorial of %d is %d.",n,fact(n)); } |
Write a program to read n […]
Continue Reading