Category: even semester
C programming 2021 Solution
2) WAP to display all the numbers from 100 to 200 divisible by 4
1 2 3 4 5 |
#include<stdio.h> void main(){ for(int i=100;i<=200;i++) i%4==0? printf("%d ",i):i; } |
3) Create a function int greater(int ,int ) that returns greater number.
1 2 3 |
int greater(int a,int b){ return a>b? a : b; } |
5)check if string is palindrome or not
1 2 3 4 5 6 7 8 9 10 11 12 |
#include<stdio.h> #include<string.h> void main(){ char string[100],temp[100]; printf("enter string"); gets(string); strcpy(temp,string); strrev(string); if(strcmp(string,temp)==0) printf("the string is palindrome"); else printf("the string is not palindrome"); } |
6)A data file contains name ,age ,address,cell number of some students WAP to list all the students who are […]
Continue Readingc progamming 2022 Makeup Solution
2) Write a program to check if two matrices are equal or not.
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 |
#include<stdio.h> int main(){ int a[100][100],b[100][100]; int r1,c1,r2,c2,i,j,flag=0; printf(“enter rows and columns of first and second matrix\n”); scanf(“%d%d%d%d”,&r1,&c1,&r2,&c2); printf(“enter elements of first matrix”); for(i=0;i<r1;i++){ for(j=0;j<c1;j++){ scanf(“%d”,&a[i][j]); } } printf(“enter elements of second matrix”); for(i=0;i<r1;i++){ for(j=0;j<c1;j++){ scanf(“%d”,&b[i][j]); } } if((r1 == r2) && (c1 == c2)){ for(i=0;i<r1;i++){ for(j=0;j<c1;j++){ if(a[i][j] ! == b[i][j]){ flag = 1; } } } if(flag == 1) printf("they are not equal"); else printf("they are equal"); } else{ printf("they are not equal"); } } |
4)Write a program using pointer to input 10 numbers and store it in array and sort in ascending order using pointer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
int main(){ int array[100],n,i,j; int *ptr; printf("enter size of array\n"); scanf("%d",&n); printf("enter %d elements ",n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } ptr = &a; for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ if(*(ptr+i) > *(ptr+j)){ temp = *(ptr + i); *(ptr + i) = *(ptr + j); *(ptr + j) = temp; } } } printf("the array in sorted order is :"); for(i=0;i<n;i++){ printf("%d",a[i]); } } |
5) write a program that reads 2 numbers from user and calculate sum and write it in a file name “sum.dat” […]
Continue ReadingEnglish New course 2022 || BIM Study Notes
Question paper Pre- board Paper SYLLABUS YEAR2021 SUBJECT CODE ENG 206 : ENGLISH 1 Syllabus Here Chapter 1 Chapter 2 Chapter 3 SYLLABUS YEAR2021 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Unit 3
Continue ReadingDiscrete Math SAQ
chapter 2 An algorithm is a finite set of precise instructions for performing a computation or for solving a problem. A linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been […]
Continue Reading