Programs Till Week 10
Programs Till Week 10
Star Rectangle:
Alphabet square:
Inverted triangle:
Part 2:
Pattern resembling 7:
Practice coding
Doubt:
Fibonacci Triangle:
Practice coding
Printing stars and # pattern (don’t know what those red things are):
Practice coding
Counting question:
Practice coding
Loop Question:
Max,min question:
Practice coding
Exam question:
Exam question:
Practice coding
Practice coding
Functions
Q1:
Practice coding
Practice coding
Question 2:
Practice coding
Question 3:
Practice coding
Practice coding
Arrays:
Practice coding
Sorting and then finding the smallest missing element in the list (works when 1 is in the list):
Practice coding
The smallest missing number in an unsorted array (only works if 1 is an element and can’t find any other
method):
Practice coding
Practice coding
Printing an array with the elements being the result of multiplication barring arr[i]:
Practice coding
NOTE: 3*4*5*6*7=2520.
Vowels in a string:
Traversing an array:
Practice coding
Reversing an array:
Merging two sorted arrays of the same size and then finding the median using user input:
Practice coding
Merging two sorted arrays of different sizes and then finding the median:
Practice coding
Practice coding
Checking duplicates:
Printing the elements which have an odd number of occurrences in the array:
Practice coding
Generalized case (ceilsearch function remains the same, only a few modifications to the main function):
Arranging an array with the smallest element printed before the largest element and so on:
Swapping diagonals:
Practice coding
Rotating by 90:
Practice coding
Done the same but this time by flipping the matrix horizontally and vertically:
Practice coding
Rotating by 270:
Practice coding
The same for 270 but by flipping the matrix vertically and horizontally:
Practice coding
Finding lowest sum of a column under constraints (maybe wrong but MS?):
\
Practice coding
Removing integers:
Copying the strings that start with an alphabet to a string and another which doesn’t start with alpha:
Practice coding
Structures
Basic example:
Array of structures:
Finding the employee with the maximum salary (logic seems to work):
Practice coding
Pointers
Reversing an array:
Practice coding
Two ways of accessing a structure using pointers (has come twice in the exam):
Practice coding
Occurrences of a character in an array with user input and the use of fgets:
Using malloc:
Practice coding
Copying arrays(pointers):
Pizza shop structure problem (I swear I will break the laptop if such questions come):
Practice coding
Practice coding
Practice coding
Practice coding
Practice coding
Practice coding
Practice coding
Practice coding
Practice coding
Text files in C
Reading from a file and then printing the content of that file:
Creating a txt file, inputting data and then reading from it:
Practice coding
Creating a new file and using fputs enter something into the new file:
Reading a file and then storing in an array and then printing the contents:
Practice coding
Reading from 2 files and getting a result from then and placing it in a 3rd file:
Practice coding
Creating two files to store max and min value of a text file containing random numbers:
Practice coding
Miscellaneous