├── Assignments ├── README.md ├── assignment_1 │ └── README.md ├── assignment_2 │ └── README.md ├── assignment_3 │ └── README.md ├── assignment_4 │ └── README.md ├── assignment_5 │ └── README.md ├── assignment_6 │ └── README.md ├── assignment_7 │ └── README.md └── assignment_8 │ └── README.md ├── C_programming_solutions ├── 2065.pdf ├── 2066.pdf ├── 2067.pdf ├── 2068.pdf └── 2069.pdf ├── README.md ├── codes ├── README.md ├── arrays │ ├── caseConverter.c │ ├── copymatirxtoanother.c │ ├── join_string.c │ ├── matrixmultiplication.c │ ├── mergeArray.c │ ├── palindromeString.c │ ├── passingarray.c │ ├── passwholearray.c │ ├── removeDuplicates.c │ ├── reverseorder.c │ ├── rowsumcolsum.c │ ├── searchElement.c │ ├── searchString.c │ ├── sorting.c │ ├── strings.c │ ├── stringstest.c │ ├── strstr.c │ ├── transposematrix.c │ └── twobythreematrix.c ├── basics │ ├── del.c │ ├── largest.c │ ├── logical.c │ ├── logical_op.c │ ├── primeornot.c │ ├── scanf_test.c │ ├── shift_op.c │ ├── sumofseries.c │ ├── sumoftwo.c │ ├── suzil.c │ ├── test.c │ └── unformatted_ex.c ├── codewisdom.png ├── control │ ├── asterisks.c │ ├── break.c │ ├── continue.c │ ├── createRecord.c │ ├── evenorodd.c │ ├── fibonacci.c │ ├── gcd.c │ ├── palindrome.c │ ├── perfectornot.c │ ├── prime_of_half.c │ ├── primeornot.c │ ├── sumofall.c │ ├── sumofevennumbers.c │ ├── sumofseries.c │ └── switchcase.c ├── filehandling │ ├── binary.c │ ├── directRandomAccess.c │ ├── file.txt │ ├── fprintfFunction.c │ ├── fscanOne.c │ ├── fscanfFunction.c │ ├── rambo.txt │ ├── read │ ├── record.c │ ├── recordRead.c │ ├── student │ ├── test.txt │ ├── tutorial_i.c │ ├── tutorial_ii.c │ ├── tutorial_iii.c │ ├── tutorial_iv.c │ └── tutorial_v.c ├── function │ ├── calculator.c │ ├── callbyref.c │ ├── callbyreference.c │ ├── callbyvalue.c │ ├── caseChanger.c │ ├── factorial_rec.c │ ├── fib.c │ ├── funcsum.c │ ├── function_transpose.c │ ├── function_transpose_i.c │ ├── infiniteloop.c │ ├── lecturequestions_functions.c │ ├── power.c │ ├── prasuna_twinprime.c │ ├── recursion1.c │ ├── recursive.c │ ├── roots.c │ ├── sorting.c │ ├── sum.c │ ├── sumRecursive.c │ ├── swap_i.c │ ├── swap_ii.c │ ├── swap_iii.c │ ├── toh.c │ └── whatisyourname.c ├── logial │ ├── C_Assignment_3.pdf │ └── README.md ├── operator │ ├── bitwise.c │ ├── break.c │ ├── exitexample.c │ ├── positiveornegative.c │ ├── prime.c │ ├── shiftoperator.c │ └── specialoperator.c ├── pointer │ ├── addmatrices.c │ ├── array_pointer.c │ ├── caseChanger.c │ ├── copyAnArrayOfDouble.c │ ├── doublepointer.c │ ├── marksOfStudents.c │ ├── maxmin.c │ ├── memory.c │ ├── memory1.c │ ├── memory3.c │ ├── nullpoint.c │ ├── one_array_pointer.c │ ├── passpointer.c │ ├── pointer_sub.c │ ├── pointerarray.c │ ├── reallocation.c │ ├── relationship1darray.c │ ├── reverseOrderWithoutReturn.c │ ├── reverseWithReturn.c │ ├── search.c │ ├── sizeOfPointer.c │ ├── sortUsingPointer.c │ ├── sumOfNnumbers.c │ ├── test.c │ ├── twodpointer.c │ └── void_pointer.c └── structure │ ├── accounts.c │ ├── arrayStruct.c │ ├── arrayStructToPointer.c │ ├── nestedstruct1.c │ ├── neststruct.c │ ├── pointerToStruct.c │ ├── strucMemTofunction.c │ ├── structToFunction.c │ ├── structwithDMA.c │ ├── stucPointerToFunction.c │ ├── tutorial_i.c │ ├── tutorial_ii.c │ ├── tutorial_iii.c │ ├── tutorial_iv.c │ └── union.c ├── forfuture ├── learngit └── README.md ├── lectures ├── Unit 1. Problem Solving with Computer │ └── README.md ├── Unit 10. Files and file handling in C │ └── README.md ├── Unit 11. Introduction to Graphics │ └── README.md ├── Unit 2. Elements of C │ └── README.md ├── Unit 3. Input and Output │ └── README.md ├── Unit 4. Operators and Expression │ └── README.md ├── Unit 5. Control Statement │ └── README.md ├── Unit 6. Arrays │ ├── README.md │ └── image.png ├── Unit 7. Functions │ └── README.md ├── Unit 8. Pointers │ └── README.md └── Unit 9. Structure and Union │ └── README.md ├── project_work ├── 2017batch │ └── README.md └── README.md └── students_email_2017.md /Assignments/README.md: -------------------------------------------------------------------------------- 1 | # NOTE 2 | 3 | • Check specific folders for specific assignment 4 | 5 | • Submit your assignment under file name as "rollnumber_yourname_assingmentNumber". for ex."01_alish_01.docx" 6 | 7 | • Every Assignment has its own due date so please be careful and submit it before due date 8 | 9 | • Each Assignment now will have Missing Gap as a topic which you should research on internet or Text Books 10 | 11 | • Morning Students upload/email your assignments to "TO BE DISCLOSED" 12 | 13 | • Day Students upload/email your assignments to "TO BE DISCLOSED" 14 | 15 | • If there's any problem regarding assignments please don't hesitate to email me punchedrock@gmail.com 16 | 17 | • Note: At this stage in your education you are responsible for your own work; I will not accept any excuses for plagiarism regardless of your intention. -------------------------------------------------------------------------------- /Assignments/assignment_1/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT I 2 | 3 | 4 | 1. Write an algorithm and flowchart to display Sum of two numbers 5 | 2. Write an algorithm and flowchart to display if the number is positive or negative 6 | 3. Write an algorithm and flowchart to display whether the number is even or odd. 7 | 4. Write an algorithm and flowchart to read three numbers and print the greatest number. 8 | 5. Write an algorithm and flowchart to find the sum of the series 1+2+3+4….. Up to entered n numbers. 9 | 6. Write an algorithm and flowchart to display factorial of a given number N 10 | 7. Write an algorithm and flowchart to read first 20 number and display only sum of even numbers. 11 | 8. Write an algorithm and flowchart to read a number n and display all of its divisors. 12 | 9. Write an algorithm and flowchart which display if number is prime or not. 13 | 10. Write short note on one of the following topic 14 | a. Boston Dynamics 15 | b. Palantir Technologies 16 | c. Twitter 17 | d. Viber 18 | e. Elon Musk 19 | 20 | Note: At this stage in your education you are responsible for your own work; I will not accept any excuses for plagiarism regardless of your intention. -------------------------------------------------------------------------------- /Assignments/assignment_2/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT II 2 | 3 | 1. Write short notes Signed and Unsigned short Integers. 4 | 2. Write short notes Signed and Unsigned long Integers. 5 | 3. Write short notes Double Precision and Long Double Precision Floating point 6 | 4. Write short notes Real Constants and also fractional form constants and exponential form constants mantissa/exponents). 7 | 5. Write short notes Symbolic Constants. Write rules for defining a symbolic constants. Also explain advantages of symbolic constants. 8 | 9 | Note: At this stage in your education you are responsible for your own work; I will not accept any excuses for plagiarism regardless of your intention. -------------------------------------------------------------------------------- /Assignments/assignment_3/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT III 2 | 3 | 1. WAP to display Sum of two numbers 4 | 2. WAP to display if the number is positive or negative 5 | 3. WAP to display whether the number is even or odd. 6 | 4. WAP to read three numbers and print the greatest number. 7 | 5. WAP to find the sum of the series 1+2+3+4….. Up to entered n numbers. 8 | 6. WAP to display factorial of a given number N 9 | 7. WAP to read first 20 number and display only sum of even numbers. 10 | 8. WAP to read a number n and display all of its divisors. 11 | 9. WAP which displays if a number is prime or not. 12 | 10. What do you mean by Precedence And Associativity Of Operators in C. Explain with some examples. 13 | 14 | 15 | Note: At this stage in your education you are responsible for your own work; I will not accept any excuses for plagiarism regardless of your intention. -------------------------------------------------------------------------------- /Assignments/assignment_4/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT IV 2 | 3 | ###Theoretical Assignment### 4 | 5 | 1. Explain in detail about storage class. Write in detail about 4 different storage class. 6 | 7 | 2. Write one simple example of for-loop. Explain about the steps how it works. 8 | 9 | 3. Write one simple example of while-loop. Explain about the steps how it works. 10 | 11 | 4. Write a paragraph and an example of each about strlen(), strcpy(), strcat(), strcmp(), strrev(). 12 | 13 | 5. What is array? How array is different from ordinary variable. 14 | 15 | 6. How can you prepare a student mark sheets software using the things you’ve learned till now? Give me the list of the things you’ve learned and how can you use it to do what kind of operation to prepare a mark sheet of a student. 16 | 17 | 18 | 19 | ###Practical Assignment### 20 | 21 | 1. WAP a program to read n numbers from user and store in an array and then rearrange the array in the reverse order. 22 | 23 | 2. WAP a program to read n numbers in an array and remove the duplicate numbers from the array. 24 | 25 | 3. WAP a program to read two arrays and merge these two arrays into third array. 26 | 27 | 4. WAP to merge two sorted arrays in another array in a sorted order. 28 | 29 | 5. WAP to find transpose of a given Matrix 30 | 31 | 6. Write a program to read a string and search a specified word in given string. (use function strstr() ) 32 | 33 | 7. WAP in C to take input M*N from user and find a row sum and column sum 34 | 35 | ###Eg: 36 | | | | | 37 | |----|----|----| 38 | | 2 | 4 | 6 | 39 | | 98 | 88 | 186 | 40 | | 100 | 92 | | 41 | 42 | 43 | ###Arrays and Strings:### 44 | 45 | 1. WAP in C to initialize any 10 value in an array and display them. 46 | 47 | 2. WAP to input any 10 number by user and display them. 48 | 49 | 3. WAP in C to input any 10 number in an array and print them along with the Total and average of that numbers. 50 | 51 | 4. WAP in C to input any 10 numbers in an array and count no. of ODD and EVEN and find 52 | out their sum and display them. 53 | 54 | 5. WAP in C to input any 10 numbers in an array and search an element. 55 | 56 | 6. WAP to input any 10 numbers in an array and find out the Maximum and Minimum Value. 57 | 58 | 7. WAP to input any 5 elements in an array and print them in reverse order too. 59 | 60 | ![alt text](https://github.com/ashim888/csit-c/blob/master/lectures/Unit%206.%20Arrays/image.png) 61 | 62 | 63 | ###Character array and String 64 | 1. WAP to input and output of String using scanf() and printf(). 65 | 66 | 2. WAP to input and output of String using gets() and puts(). 67 | 68 | 3. WAP to input and output of Character array using getchar() and putchar(). 69 | 70 | 4. WAP to input a string and find out the length of string using strlen() and without 71 | using strlen(). 72 | 73 | 5. WAP to copy a string from one to another using strcpy() and without using strcpy(). 74 | 75 | 6. WAP to concatenate two string using strcat() and without using strcat(). 76 | 77 | 7. WAP to compare two string using strcmp() and without using Strcmp(). 78 | 79 | 8. WAP to reverse a string using strrev() and without using strrev(). 80 | 81 | 9. WAP to find whether the given string is palindrome or not. 82 | 83 | 10. WAP to input the name of any five student and sort them alphabetically in ascending 84 | order. 85 | 86 | 11. WAP to input a string and convert it into upper case and vice versa. 87 | 88 | 12. WAP to take the string using gets(), and pass to the function to find and return number 89 | of words, whitespace in that string. 90 | 91 | 13. Write a program to read a string and search a specified word in given string. 92 | 93 | -------------------------------------------------------------------------------- /Assignments/assignment_5/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT V 2 | 3 | 4 | ###Function### 5 | 1. Write a Program in C to input a number and find whether the number is exactly divisible by 5 and 7 or not using functions: 6 | + No return no argument 7 | 8 | + No return with argument 9 | 10 | + Return with no argument 11 | 12 | + Return with argument 13 | 14 | 2. WAP in C to input a number and check whether the number is palindrome or not using function. 15 | 3. WAP in C to find whether the given number is prime or not using function 16 | 4. WAP in C to print all prime number less than 500 using function 17 | 5. WAP in C to print print TWIN PRIME less than 500 using function. [if two consecutive odd numbers are both prime then they are known as twin prime]. 18 | 6. WAP in C to convert decimal number to binary using functions 19 | 7. WAP in C to find all the divisor of a given number using functions 20 | 8. Write a function Power that computes X raised to the power Y for integer X and Y and return double type value. 21 | 22 | 23 | ###Arrays and Strings### 24 | 1. Write a Program in C to input any 10 elements in an array and display them using function. (Passing individual array element). 25 | 26 | 2. Write a program in c to input any 10 number in an array and sort them in ascending order using function. (Pass Whole array). 27 | 28 | 3. Write a program in c to input any 10 number in an array and sort them in descending order using function. (Pass Whole array). 29 | 30 | 31 | ###Recursion### 32 | 1. Write a program in C to find factorial of a given number using Recursive Function 33 | 2. WAP in C to generate the Fibonacci series using recursive Function. 34 | 3. Write a recursive function to generate the particular term in Fibonacci Series. ( eg. 8th 35 | term: 13). 36 | 37 | 4. WAP in C to display the reverse number using Recursion. 38 | 39 | 5. WAP to find the sum of digits entered by the user. 40 | 41 | 6. WAP to find the sum of Natural number up to 10 using recursion. 42 | 7. WAP in C to ask a number and Power to be calculated for that number. -------------------------------------------------------------------------------- /Assignments/assignment_6/README.md: -------------------------------------------------------------------------------- 1 | # ASSIGNMENT VI 2 | 3 | 4 | 1. What is pointer and explain its applications. Write a program that uses pointers to copy an array of double. 5 | 6 | 2. Write a function that is passed with an array of n pointers which returns the maximum. 7 | 8 | 3. Justify that pointer is jewel in C language. Write a function that is passed an array of n pointers to floats and returns a newly created array that contains those n float values in reverse order. Assume any necessary data. 9 | 10 | 4. Write a function that uses pointers to search for the address of a given integer in a given array. If the given integer is found, the function returns its address; otherwise it returns NULL. 11 | 12 | 5. Write a program that uses pointers to copy an array of integer. 13 | 14 | 6. Write a function that is passed an array of n pointer to floats and returns a newly created array that contains those n float values. 15 | 16 | 7. Explain the pointer to structure with example. 17 | 18 | 8. Explain the pointer arithmetic with example. 19 | 20 | 9. Write a program to sort 'n' numbers in ascending order using dynamic memory. 21 | 22 | 10. What is dynamic memory allocation (DMA)? How can you use it in C? 23 | 24 | 11. What are the advantages of dynamic memory allocation over static memory allocation? 25 | 26 | 12. How is malloc() function different from calloc() function? 27 | 28 | 13. Write a program to read number of employees,n, working in a company. Reserve the memory required to store age of n employees using malloc() function. Read age of n employees from user and count the number of employees of age above 80 years. 29 | 30 | 14. Write a program to read a matrix of size m*n entered by the user and display its transpose matrix. Use Dynamic Memory Allocation. 31 | -------------------------------------------------------------------------------- /Assignments/assignment_7/README.md: -------------------------------------------------------------------------------- 1 | ###ASSIGNMENT VII 2 | 3 | 4 | Complete question number 1 to 8 from all the previous questions from 2065-2071, if possible collect the question paper from 2072 as well and try to solve it. 5 | 6 | I've provided previous questions [Click Me](http://www.ashimlamichhane.com.np/2017/03/fundamentals-of-computer-programming-old-questions/) 7 | 8 | 9 | 10 | NOTE: This assignment has two weeks of time and I expect each and every one to submit it in a written form in A4 size paper. If anyone fails to complete this assignment they would have to talk to the co-ordinator or student service department. 11 | -------------------------------------------------------------------------------- /Assignments/assignment_8/README.md: -------------------------------------------------------------------------------- 1 | ASSIGNMENT VIII 2 | 3 | 4 | Complete question number 9 and 10 (include both question if there's OR given) from all the previous questions from 2065-2071, if possible collect the question paper from 2072 as well and try to solve it. 5 | 6 | I've provided previous questions [Click Me](http://www.ashimlamichhane.com.np/2017/03/fundamentals-of-computer-programming-old-questions/) 7 | 8 | 9 | 10 | NOTE: I expect each and every one to submit it in a written form in A4 size paper. If anyone fails to complete this assignment they would have to talk to the co-ordinator or student service department. 11 | -------------------------------------------------------------------------------- /C_programming_solutions/2065.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/C_programming_solutions/2065.pdf -------------------------------------------------------------------------------- /C_programming_solutions/2066.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/C_programming_solutions/2066.pdf -------------------------------------------------------------------------------- /C_programming_solutions/2067.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/C_programming_solutions/2067.pdf -------------------------------------------------------------------------------- /C_programming_solutions/2068.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/C_programming_solutions/2068.pdf -------------------------------------------------------------------------------- /C_programming_solutions/2069.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/C_programming_solutions/2069.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Course Title: Fundamentals of Computer Programming 2 | ======================================================== 3 | Fundamentals of Computer Programming (CSC-102) 4 | 5 | Tribhuvan University 6 | 7 | Institute of Science and Technology 8 | 9 | Bachelor of Science in Computer Science and Information Technology 10 | 11 | 12 | 13 | Course no: CSC-102 14 | Full Marks: 60+20+20 15 | 16 | Credit hours: 3 17 | Pass Marks: 24+8+8 18 | Nature of course: Theory (3 Hrs.) + Lab (3 Hrs.) 19 | 20 | ___Course Synopsis: This course contains the concepts of programming methodology using C.___ 21 | ___Goal: This course is designed to familiarize students to the techniques of programming in C.___ 22 | 23 | ## Course Contents: 24 | | Unit | Hours | Description | 25 | |----|----|----| 26 | |1. Problem Solving with Computer | 2 Hrs | Problem analysis, Algorithms and Flowchart, Coding, Compilation and Execution, History of C, Structure of C program, Debugging, Testing and Documentation | 27 | | 2. Elements of C | 4 Hrs. | C Tokens, Escape sequence, Delimiters, Variables, Data types, Constants/ Literals, Expressions, Statements and Comments | 28 | | 3. Input and Output | 2 Hrs. | Conversion specification, I/O operation, Formatted I/O | 29 | | 4. Operators and Expression | 4 Hrs. | Arithmetic operator, Relational operator, Logical or Boolean operator, Assignment, Operator, Ternary operator, Bitwise operator, Increment or Decrement operator, Comma operator. | 30 | | 5. Control Statement | 4 Hrs. | Branching, Looping, Conditional Statement, Exit function, Difference between break and exit | 31 | | 6. Arrays | 6 Hrs. | Introduction, Declaration of array, Initialization of array, Sorting, Multidimensional array | 32 | | 7. Functions | 5 Hrs. | Library Functions, User defined functions, Recursion, Function declaration, Local and global variables, Use of array in function, Passing by Value, Passing by Address | 33 | | 8. Pointers | 6 Hrs. | Introduction, The & and * operator, Declaration of pointer, Pointer to pointer, Pointer arithmetic, Array and Pointer, Pointer and array, Pointer with multidimensional array, Pointer and strings, Array of pointer with string, Dynamic memory allocation | 34 | | 9. Structure and Union | 5 Hrs. | Introduction, Array of structure, Passing structure to function, Passing array of structure to function, Structure within structure ( Nested Structure), Union, Pointer to structure | 35 | | 10. Files and file handling in C | 4 Hrs. | Concept of file, Opening and closing of file, Modes, Input/ output function, Random access in file, Printing a file | 36 | | 11. Introduction to Graphics | 3 Hrs. | Modes, Initialization, Graphics Function | 37 | 38 | ## Laboratory works: 39 | ``` 40 | This course requires a lot of programming practices. Each topic must be followed by a practical session. Some practical sessions include programming to: 41 | • Create, compile and run simple C programs, handle different data types available in C, perform arithmetic operations in C, perform formatted input and out put operations, perform character input and output operations. 42 | • Perform logical operations, create decision making programs, create loops to repeat task, sue different looping method. 43 | • Create user-defined factions, create recursive functions, work with automatic, global and static variables, create, manipulate arrays and matrices (single and multi-dimensional), work with pointes, dynamically allocate de-allocate storage space during runtime, manipulate strings (character arrays) using various string handling functions. 44 | • Create and use structures and files to keep record of students, employees etc 45 | ```` 46 | ## References: 47 | ```` 48 | 1. Deitel, C.: How to Program, 2/e (With CD), Pearson Education. 49 | 2. Al Kelley, Ira Pohl: "A Book on C", Pearson Education. 50 | 3. Brian W. Keringhan & Dennis M. Ritchie: "The C programming Language", PHI 51 | 4. Bryons S. Gotterfried: "Programming with C," TMH 52 | 5. Stephen G. Kochan: "Programming in C", CBS publishers & distributors. 53 | 6. Yashavant Kanetkar: "Let us C", BPB Publications 54 | ```` -------------------------------------------------------------------------------- /codes/README.md: -------------------------------------------------------------------------------- 1 | #### C Codes 2 | ``` 3 | C codes for BScCSIT Students 4 | Please do check the codes and if necessary feel free to contribute to the project 5 | ```` 6 | ![Image of yoda](https://github.com/ashim888/csit-c/blob/master/codes/codewisdom.png) -------------------------------------------------------------------------------- /codes/arrays/caseConverter.c: -------------------------------------------------------------------------------- 1 | /* WAP to input a string and convert it into upper case and vice versa. */ 2 | 3 | #include 4 | 5 | int main () 6 | { 7 | int c = 0; 8 | char ch, s[1000]; 9 | 10 | printf("Input a string\n"); 11 | gets(s); 12 | 13 | while (s[c] != '\0') { 14 | ch = s[c]; 15 | if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) 16 | s[c] = s[c] ^ 32; 17 | c++; 18 | } 19 | 20 | printf("%s\n", s); 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /codes/arrays/copymatirxtoanother.c: -------------------------------------------------------------------------------- 1 | /* WAP in c to copy the element of one Matrix to another. */ 2 | #include 3 | int main(void){ 4 | int i,j,m,n; 5 | 6 | printf("Enter Number of Rows: "); 7 | scanf("%d",&m); 8 | printf("Enter Number of Columns: "); 9 | scanf("%d",&n); 10 | int matrix[m][n],see[m][n]; 11 | 12 | for(i=0;i 2 | #include 3 | 4 | int main() { 5 | char a[50], b[30]; 6 | 7 | printf("\nEnter String 1 :"); 8 | scanf("%s",a); 9 | printf("\nEnter String 2 :"); 10 | scanf("%s",b); 11 | 12 | int i, j; 13 | 14 | i = strlen(a); 15 | printf("i\tj\ta[i]\t[j]\n"); 16 | for (j = 0; b[j] != '\0'; i++, j++) { 17 | printf("%d\t%d\ta[%d]\t%c\n",i,j,i,b[j]); 18 | a[i] = b[j]; 19 | } 20 | 21 | a[i] = '\0'; 22 | printf("Concated string is :%s\n", a); 23 | } -------------------------------------------------------------------------------- /codes/arrays/matrixmultiplication.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int k,m,n,p,q,c,d,f[10][10],s[10][10],M[10][10],sum=0; 5 | printf("ROWS And Colums\n"); 6 | scanf("%d%d",&m,&n); 7 | printf("\nEnter First Matrix:\n"); 8 | for (int i = 0; i < m; i++) 9 | { 10 | for (int j = 0; j < n; j++) 11 | { 12 | scanf("%d",&f[i][j]); 13 | } 14 | } 15 | // printf("\n\nFirst Matrix:\n"); 16 | // for (int i = 0; i < m; i++) 17 | // { 18 | // for (int j = 0; j < n; j++) 19 | // { 20 | // printf("%d\t",f[i][j]); 21 | // } 22 | // printf("\n"); 23 | // } 24 | 25 | printf("\nEnter Second Matrix:\n"); 26 | for (int i = 0; i < m; i++) 27 | { 28 | for (int j = 0; j < n; j++) 29 | { 30 | scanf("%d",&s[i][j]); 31 | } 32 | } 33 | // printf("\n\nSecond Matrix:\n"); 34 | // for (int i = 0; i < m; i++) 35 | // { 36 | // for (int j = 0; j < n; j++) 37 | // { 38 | // printf("%d\t",s[i][j]); 39 | // } 40 | // printf("\n"); 41 | // } 42 | // printf("\n\n"); 43 | sum=0; 44 | for (int i = 0; i < m; i++) 45 | { 46 | for (int j = 0; j < n; j++) 47 | { 48 | for(k=0;k 3 | 4 | int main(void) 5 | { 6 | int m,n; 7 | int c[100]; 8 | printf("Enter Size of first Array: \n"); 9 | scanf("%d",&m); 10 | printf("Enter Size of Second Array: \n"); 11 | scanf("%d",&n); 12 | 13 | int a[m],b[n]; //Declaring array a and b with its size m and n accordingly 14 | 15 | int myval=m+n; //Size of the new array 16 | 17 | for(int i=0;i 8 | #include 9 | 10 | int main(void) { 11 | char string1[20], *answer_str = ""; 12 | int i, length; 13 | 14 | printf("Enter a string:"); 15 | scanf("%s", string1); 16 | 17 | length = strlen(string1); 18 | 19 | for(i = 0; i < length / 2; i++) { 20 | if(string1[i] != string1[length - i - 1]) { 21 | answer_str = "not "; 22 | break; 23 | } 24 | } 25 | 26 | printf("%s is %sa palindrome\n", string1, answer_str); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /codes/arrays/passingarray.c: -------------------------------------------------------------------------------- 1 | /* ONE ELEMENT AT A TIME */ 2 | #include 3 | 4 | void display(int n){ 5 | printf("%d\t",n ); 6 | 7 | } 8 | 9 | int main(void){ 10 | int nums[5]={100,23,44,3,65},i; 11 | 12 | printf("\nThe content of array is: \n"); 13 | for (int i = 0; i < 5; i++) 14 | { 15 | display(nums[i]); 16 | } 17 | printf("\n"); 18 | } -------------------------------------------------------------------------------- /codes/arrays/passwholearray.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void change(int a[]){ 4 | a[0]=10; 5 | a[1]=20; 6 | a[2]=30; 7 | a[3]=40; 8 | a[4]=50; 9 | 10 | 11 | } 12 | 13 | int main(void){ 14 | int nums[5]={100,23,44,3,65},i; 15 | // int a[]; 16 | 17 | printf("\nBEFORE FUNCTION CALL: \n"); 18 | for (int i = 0; i < 5; i++) 19 | { 20 | printf("\t%d",nums[i]); 21 | } 22 | printf("\n"); 23 | change(nums); /* PASSING ARRAYS NUMS TO FUNCTION */ 24 | printf("\nAFTER FUNCTION CALL\n"); 25 | for (int i = 0; i < 5; i++) 26 | { 27 | printf("\t%d",nums[i]); 28 | } 29 | printf("\n"); 30 | } -------------------------------------------------------------------------------- /codes/arrays/removeDuplicates.c: -------------------------------------------------------------------------------- 1 | /* 2 | WAP a program to read n numbers in an array and remove the duplicate numbers from the array. 3 | SAMPLE: 1 2 1 2 3 4 | */ 5 | 6 | 7 | #include 8 | int main(void){ 9 | int x,n,myvar=0; 10 | printf("Enter a number: \t"); 11 | scanf("%d",&n); 12 | int arr[n],changedarr[n]; 13 | 14 | for(x=0;x 5 | int main(void){ 6 | int i,n; 7 | printf("Enter a number: \n"); 8 | scanf("%d",&n); 9 | int arr[n]; 10 | 11 | for(i=0;i=0;i--){ 17 | printf("%d",arr[i] ); 18 | } 19 | printf("\n"); 20 | } -------------------------------------------------------------------------------- /codes/arrays/rowsumcolsum.c: -------------------------------------------------------------------------------- 1 | /* WAP to find the Row Sum and Column Sum of a Matrix. */ 2 | 3 | #include 4 | int main(void){ 5 | int i,j,m,n,sum=0; 6 | 7 | printf("Enter Number of Rows: "); 8 | scanf("%d",&m); 9 | printf("Enter Number of Columns: "); 10 | scanf("%d",&n); 11 | int matrix[m][n],see[m][n]; 12 | 13 | for(i=0;i 4 | 5 | int main(void){ 6 | 7 | int myarr[10],n,pos; 8 | printf("ENTER 10 numbers\n"); 9 | for(int i=0;i<5;i++){ 10 | scanf("%d",&myarr[i]); 11 | } 12 | printf("ENTER a number to search: \n"); 13 | scanf("%d",&n); 14 | 15 | for(int i=0;i<10;i++){ 16 | if(myarr[i]==n){ 17 | printf("NUMBER FOUND AT POSITION: %d\n",i); 18 | break; 19 | } 20 | else{ 21 | if(i==5){ 22 | printf("NOT FOUND\n"); 23 | } 24 | } 25 | } 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /codes/arrays/searchString.c: -------------------------------------------------------------------------------- 1 | /* 2 | Write a program to read a string and search a specified word in given string. 3 | */ 4 | 5 | 6 | #include 7 | #include 8 | 9 | int match(char [], char []); 10 | 11 | int main() { 12 | char a[100], b[100]; 13 | int position; 14 | 15 | printf("Enter some text\n"); 16 | gets(a); 17 | 18 | printf("Enter a string to find\n"); 19 | gets(b); 20 | 21 | position = match(a, b); 22 | 23 | if(position != -1) { 24 | printf("Found at location %d\n", position + 1); 25 | } 26 | else { 27 | printf("Not found.\n"); 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | int match(char text[], char pattern[]) { 34 | int c, d, e, text_length, pattern_length, position = -1; 35 | 36 | text_length = strlen(text); 37 | pattern_length = strlen(pattern); 38 | 39 | if (pattern_length > text_length) { 40 | return -1; 41 | } 42 | 43 | for (c = 0; c <= text_length - pattern_length; c++) { 44 | position = e = c; 45 | 46 | for (d = 0; d < pattern_length; d++) { 47 | if (pattern[d] == text[e]) { 48 | e++; 49 | } 50 | else { 51 | break; 52 | } 53 | } 54 | if (d == pattern_length) { 55 | return position; 56 | } 57 | } 58 | 59 | return -1; 60 | } 61 | 62 | //USING POINTER 63 | 64 | // #include 65 | // #include 66 | 67 | 68 | // int main() 69 | // { 70 | // const char haystack[20] = "TutorialsPoint"; 71 | // const char needle[10] = "Point"; 72 | // char *ret; 73 | 74 | // ret = strstr(haystack, needle); 75 | 76 | // printf("The substring is: %s\n", ret); 77 | 78 | // return(0); 79 | // } 80 | -------------------------------------------------------------------------------- /codes/arrays/sorting.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int nums[50],i,j,n,temp; 6 | printf("How many Numbers are there?\t"); 7 | scanf("%d",&n); 8 | 9 | printf("\nEnter %d numbers: \n",n); 10 | for(i=0;inums[j]){ 33 | temp=nums[i]; 34 | nums[i]=nums[j]; 35 | nums[j]=temp; 36 | 37 | 38 | } 39 | printf("%d\t%d\t%d\t%d\t%d\n",i,j,nums[i],nums[j],temp); 40 | } 41 | printf("\n-----------------------------------\n"); 42 | } 43 | printf("\nThe numbers in ascending order:\n"); 44 | for(i=0; i 2 | 3 | int main () { 4 | 5 | char greeting[8] = {'H', 'e', 'l', 'l', 'o', '\0','a'}; 6 | printf("Greeting message: %s\n", greeting ); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /codes/arrays/stringstest.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | char name[30],ch; 4 | int i=0; 5 | printf("Enter name: "); 6 | while(ch!='\n') // terminates if user hit enter 7 | { 8 | ch=getchar(); 9 | name[i]=ch; 10 | i++; 11 | } 12 | name[i]='\0'; // inserting null character at end 13 | printf("Name: %s",name); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /codes/arrays/strstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | const char haystack[20] = "TutorialsPoint"; 8 | const char needle[10] = "Point"; 9 | char *ret; 10 | 11 | ret = strstr(haystack, needle); 12 | 13 | printf("The substring is: %s\n", ret); 14 | 15 | return(0); 16 | } -------------------------------------------------------------------------------- /codes/arrays/transposematrix.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int m, n, c, d ; 6 | 7 | printf("Enter the number of rows and columns of matrix\n"); 8 | scanf("%d%d", &m, &n); 9 | int matrix[m][n]; 10 | printf("Enter the elements of matrix\n"); 11 | 12 | for (c = 0; c < m; c++){ 13 | for(d = 0; d < n; d++){ 14 | scanf("%d",&matrix[c][d]); 15 | } 16 | } 17 | 18 | printf("The Entered matrix\n"); 19 | for (c = 0; c < m; c++){ 20 | for(d = 0; d < n; d++){ 21 | printf("\t%d",matrix[c][d]); 22 | } 23 | printf("\n"); 24 | } 25 | 26 | printf("\n\nTranspose of entered matrix :-\n"); 27 | 28 | for (d = 0; d < n; d++) { 29 | for (c = 0; c< m; c++) 30 | printf("%d\t",matrix[c][d]); 31 | printf("\n"); 32 | } 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /codes/arrays/twobythreematrix.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(void){ 3 | int matrix[2][3],i,j; 4 | for(i=0;i<2;i++){ 5 | for(j=0;j<3;j++){ 6 | printf("Enter Matrix[%d][%d]: ",i,j); 7 | scanf("%d",&matrix[i][j]); 8 | } 9 | } 10 | printf("The Entered Matrx\n"); 11 | for(i=0;i<2;i++){ 12 | for(j=0;j<3;j++){ 13 | printf("%d\t",matrix[i][j]); 14 | 15 | } 16 | printf("\n"); 17 | } 18 | } -------------------------------------------------------------------------------- /codes/basics/del.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a =0,b=10; 5 | if(a&&b){ 6 | printf("True"); 7 | } 8 | else{ 9 | printf("False"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /codes/basics/largest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a,b,c; 5 | printf("Enter three numbers\n"); 6 | scanf("%d%d%d",&a,&b,&c); 7 | if (a>b&&a>c) 8 | { 9 | printf("%d is largest\n", a); 10 | } 11 | else if (b>c) 12 | { 13 | printf("%d is largest\n", b); 14 | } 15 | else{ 16 | printf("%d is largest\n", c); 17 | } 18 | } -------------------------------------------------------------------------------- /codes/basics/logical.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int a=1,b=20,c=21; 4 | 5 | 6 | if(a&&b){ 7 | printf("if condition"); 8 | } 9 | else{ 10 | printf("else cond"); 11 | } 12 | 13 | if(a>b && a>c){ 14 | printf("A is greater"); 15 | } 16 | 17 | else if(b>c&&b>a){ 18 | printf("B is greater"); 19 | } 20 | else{ 21 | printf("C is greater"); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /codes/basics/logical_op.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int n1=60,n2=51,AND, OR, XOR; 4 | AND= n1 & n2; 5 | OR= n1 | n2; 6 | XOR= n1 ^ n2; 7 | printf("AND=%d\n",AND ); printf("OR=%d\n",OR ); printf("XOR=%d\n",XOR ); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /codes/basics/primeornot.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int max_limit,flag=0; 4 | printf("Enter any number: "); 5 | scanf("%d",&max_limit); 6 | for (int i = 1; i <= max_limit; i++) 7 | { 8 | flag=0; 9 | for (int j = 1; j<=i; j++) 10 | { 11 | if (i%j==0){ 12 | flag++; 13 | } 14 | } 15 | if (flag==2){ 16 | printf("%d is prime\n",i ); 17 | } 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /codes/basics/scanf_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | 4 | //fieldwidth test 5 | int d; 6 | printf("Enter Max 5 Numbers: "); 7 | scanf("%5d",&d); 8 | printf("The value of d is %d",d ); 9 | 10 | // Whitespace characters example 11 | // int d; 12 | // char ch; 13 | // printf("Enter Number: "); 14 | // scanf(" %d",&d); 15 | // printf("Enter a character: "); 16 | // scanf(" %c",&ch); 17 | // printf("\nNumber: %d \t Character: %c",d,ch); 18 | 19 | //Ordinary character 20 | 21 | // int day,year,month; 22 | // printf("Enter your birthdate in DD-MM-YYYY format"); 23 | // scanf("%d-%d-%d",&day,&month,&year); 24 | // printf("Bithday %d/%d/%d",day,month,year); 25 | 26 | // String test 27 | // char string[10]; 28 | // printf("Enter Your Name"); 29 | // scanf("%s",string); 30 | // printf("Your Name is %s",string); 31 | 32 | // String test II 33 | // Restricts The user to only allow capital letters 34 | // char string[10]; 35 | // printf("Enter Your Name in uppercase:"); 36 | // scanf("%[A-Z]",string); 37 | // printf("Your Name is %s",string); 38 | 39 | // String test III 40 | // %[^\n] tells the compiler to read a string until a newline character is entered 41 | // char string[10]; 42 | // printf("Enter Your Name:"); 43 | // scanf("%[^\n]",string); 44 | // printf("My Name is %s",string); 45 | 46 | 47 | } -------------------------------------------------------------------------------- /codes/basics/shift_op.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | unsigned int n1=60 ,left, right; 4 | left =n1 << 3; 5 | right =n1 >> 3; 6 | 7 | printf("%u \n", left); 8 | printf("%u\n", right); 9 | printf("%u\n",~n1); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /codes/basics/sumofseries.c: -------------------------------------------------------------------------------- 1 | // SUM OF SERIES USING WHILE LOOP 2 | #include 3 | 4 | int main(){ 5 | int n,sum=0,a=1; 6 | printf("Enter any number: "); 7 | scanf("%d",&n); 8 | 9 | while(a<=n){ 10 | // printf("the number is %d\n", a); 11 | sum+=a; 12 | a++; 13 | } 14 | printf("the sum is %d\n",sum ); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /codes/basics/sumoftwo.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Ashim Lamichhane 3 | PROGRAM: To Display Sum Of Two Numbers 4 | */ 5 | 6 | /* 7 | Step 1: Start 8 | Step 2: Declare variables a,b and sum=0 9 | Step 3: Operate sum=a+b 10 | Step 4: Finally display the value of sum 11 | Step 5: Stop 12 | */ 13 | 14 | #include 15 | int main() { 16 | 17 | int a,b,sum = 0; 18 | printf("Enter Two numbers: "); 19 | scanf("%d%d", &a,&b); 20 | sum=a+b; 21 | printf("The Sum of two numbers is %d\n",sum); 22 | } 23 | -------------------------------------------------------------------------------- /codes/basics/suzil.c: -------------------------------------------------------------------------------- 1 | /* finding prime number 2 | if there is any number between [2,half of given number] that divides our given number with remainder 0 then it is not prime(composite) else it is prime. */ 3 | #include 4 | 5 | int main (){ 6 | int a,c; 7 | printf ("Enter any number : "); 8 | scanf("%d",&a); 9 | for(int i = 2;i<=a/2;i++){ 10 | if(a%i==0){ 11 | c=1; 12 | break; 13 | 14 | } 15 | } 16 | if(c==1){ 17 | printf("%d is composite",a); 18 | } 19 | else{ 20 | printf("%d is prime",a); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /codes/basics/test.c: -------------------------------------------------------------------------------- 1 | //This is just a basic example 2 | #include 3 | 4 | int main(){ 5 | int value_test=1; 6 | //int value_test=4294967295; 7 | printf("the value of a is %u\n",value_test); 8 | //printf("size of an integer value_test is %lu",sizeof(value_test)); 9 | 10 | /* 11 | unsigned char a='A'; 12 | signed char b='a'; 13 | printf("The character is unsigned=%d and signed=%d",a,b); 14 | 15 | typedef int ashim; 16 | ashim nepal=56; 17 | printf("value of ashim nepal is %d",nepal); 18 | */ 19 | 20 | int a=60,b=15; 21 | // printf("%d\n", a-b); 22 | // printf("%d\n", b-a); 23 | // printf("%d\n", b%a); 24 | // printf("%d\n", a%b); 25 | 26 | // printf("a =%d\n",a); 27 | // printf("a =%d\n",++a); 28 | // printf("a =%d\n",a++); 29 | // printf("a =%d\n",a); 30 | 31 | // Conditional operator 32 | // int larger= a>b ? a : b; 33 | // printf("The larger number is %d\n", larger); 34 | 35 | // Bitwise And 36 | // printf("%lu\n",sizeof(a)); 37 | // printf("%d\n",a&b); 38 | 39 | // Bitwise Shift 40 | printf("%d\n",a<<3 ); 41 | printf("%d\n",a>>4 ); 42 | printf("%d\n",~a ); 43 | 44 | int c=(a=1,b=2,a+b); 45 | printf("%d\n",c ); 46 | } 47 | -------------------------------------------------------------------------------- /codes/basics/unformatted_ex.c: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | int main(void){ 4 | 5 | char string[10]; 6 | printf("Enter Your Name"); 7 | //gets is an example of unformatted i/o function 8 | gets(string); 9 | printf("Your Name is %s",string); 10 | } 11 | -------------------------------------------------------------------------------- /codes/codewisdom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/codes/codewisdom.png -------------------------------------------------------------------------------- /codes/control/asterisks.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int n; 4 | printf("enter Value: "); 5 | scanf("%d",&n); 6 | 7 | for (int i = n; i>= 1; i--) 8 | { 9 | // for (int j = 1; j<=i; j++) 10 | // { 11 | // printf("*\t"); 12 | // } 13 | for (int j = i; j>=1; j--) 14 | { 15 | printf("*\t"); 16 | } 17 | printf("\n"); 18 | } 19 | } -------------------------------------------------------------------------------- /codes/control/break.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main () { 3 | /* local variable definition */ 4 | int a = 10; 5 | /* while loop execution */ 6 | while( a < 20 ) { 7 | printf("value of a: %d\n", a); 8 | a++; 9 | if( a > 15) 10 | { 11 | /* terminate the loop using break statement */ 12 | break; 13 | } 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /codes/control/continue.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main () { 3 | /* local variable definition */ 4 | int a = 10; 5 | /* do loop execution */ 6 | do { 7 | if( a == 15) { 8 | /* skip the iteration */ 9 | a = a + 1; 10 | // printf("value of a: %d\n", a); 11 | continue; 12 | } 13 | printf("value of a: %d\n", a); 14 | a++; 15 | } while( a < 20 ); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /codes/control/createRecord.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void create_record(); 5 | 6 | void mychoice(); 7 | 8 | char calc_grade(int per); 9 | 10 | char *format_grade_message(char grade); 11 | 12 | int main(void) 13 | { 14 | mychoice(); 15 | // create_record(); 16 | // getch(); 17 | } 18 | 19 | void mychoice(){ 20 | int choice; 21 | // clrscr(); 22 | printf("\n\n\t*********************************************************\n"); 23 | printf("\n\n\t\t\tPlease Select an option\n"); 24 | printf("\n\n\t*********************************************************\n"); 25 | printf("\n\n\t\t\t1. ADD RECORD:\n"); 26 | printf("\n\n\t\t\t2. PRINT MARKSHEET\n"); 27 | printf("\n\n\t\t\t3. ..........\n"); 28 | printf("\n\n\t\t\t4. ..........\n"); 29 | printf("\n\n\t\t\t5. EXIT\n"); 30 | printf("\n\n\tPlease Enter your choice:\t"); 31 | scanf("%d",&choice); 32 | 33 | switch(choice) 34 | { 35 | case 1 : 36 | // printf("y pressed\n"); 37 | create_record(); 38 | break; 39 | case 2 : 40 | printf("Pressed 2\n"); 41 | break; 42 | case 3 : 43 | printf("Pressed 3\n"); 44 | break; 45 | case 4 : 46 | printf("Pressed 4\n"); 47 | break; 48 | case 5 : 49 | printf("Pressed Exit\n"); 50 | break; 51 | 52 | default : 53 | printf("\n\t*\t\tTry again"); 54 | } 55 | } 56 | 57 | void create_record() 58 | { 59 | int roll,it,c,prob,stat,cal; 60 | float total,per; 61 | char name[20],grade,sign='%'; 62 | printf("\n\n\t*********************************************************"); 63 | printf("\n\t*\t\t\t\t\t\t\t*"); 64 | printf("\n\t*\t\t CREATE NEW RECORD \t\t\t*"); 65 | printf("\n\t*\t\t\t\t\t\t\t*"); 66 | printf("\n\t*\tEnter the name of the student : "); 67 | scanf("%s",name); 68 | printf("\t*\t\t\t\t\t\t\t*"); 69 | printf("\n\t*\tEnter roll no. : "); 70 | scanf("%d",&roll); 71 | printf("\t*\t\t\t\t\t\t\t*"); 72 | printf("\n\t*\tEnter the marks in IT : "); 73 | scanf("%d",&it); 74 | printf("\t*\t\t\t\t\t\t\t*"); 75 | printf("\n\t*\tEnter the marks in C programming : "); 76 | scanf("%d",&c); 77 | printf("\t*\t\t\t\t\t\t\t*"); 78 | printf("\n\t*\tEnter the marks in probability : "); 79 | scanf("%d",&prob); 80 | printf("\t*\t\t\t\t\t\t\t*"); 81 | printf("\n\t*\tEnter the marks in statistics-I : "); 82 | scanf("%d",&stat); 83 | printf("\t*\t\t\t\t\t\t\t*"); 84 | printf("\n\t*\tEnter the marks in calculus : "); 85 | scanf("%d",&cal); 86 | printf("\t*\t\t\t\t\t\t\t*"); 87 | total=it+c+prob+stat+cal; 88 | per=total/5; 89 | printf("\n\t*\tTotal marks obtained = %f ",total); 90 | printf("\n\t*\t\t\t\t\t\t\t*"); 91 | printf("\n\t*\tPercentage = %f",per);printf("%c",sign); 92 | printf("\n\t*\t\t\t\t\t\t\t*"); 93 | grade = calc_grade(per); 94 | printf("\n\t*\tGrade = %c", grade); 95 | printf("\n\t*\t\t\t%s !!! ", format_grade_message(grade)); 96 | } 97 | 98 | char calc_grade(int per) 99 | { 100 | if (per >= 80) 101 | return 'A'; 102 | else if (per >= 60) 103 | return 'B'; 104 | else if (per >= 45) 105 | return 'C'; 106 | else if (per >= 35) 107 | return 'D'; 108 | else 109 | return 'E'; 110 | } 111 | 112 | char *format_grade_message(char grade) 113 | { 114 | switch (grade) 115 | { 116 | case 'A' : 117 | return "DISTINCTION"; 118 | case 'B' : 119 | return "FIRST DIVISION"; 120 | case 'C' : 121 | return "SECOND DIVISION"; 122 | case 'D' : 123 | return "THIRD DIVISION"; 124 | default : 125 | return "Fail"; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /codes/control/evenorodd.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int n; 5 | printf("Enter Any Number\n"); 6 | scanf("%d",&n); 7 | if(n%2==0){ 8 | printf("The number %d is even\n", n); 9 | } 10 | else{ 11 | printf("The number %d is odd\n", n); 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /codes/control/fibonacci.c: -------------------------------------------------------------------------------- 1 | /* 2 | @author: Ashim Lamichhane 3 | PROGRAM: TO FINDOUT FIBONACCI SERIES 4 | */ 5 | #include 6 | 7 | int main(){ 8 | 9 | int first=0,second=1,new,n; 10 | printf("Enter a number:"); 11 | scanf("%d",&n); 12 | printf("iteration\tfirst\tsecond\tnew"); 13 | for(int i=0;i<=n;i++){ 14 | if(i<=1){ 15 | new=i; 16 | } 17 | else{ 18 | new = first + second; 19 | first = second; 20 | second = new; 21 | } 22 | 23 | printf("\n%dth\t\t%d\t%d\t%d\n",i,first,second,new); 24 | } 25 | return 0; 26 | } -------------------------------------------------------------------------------- /codes/control/gcd.c: -------------------------------------------------------------------------------- 1 | /* 2 | @author: Ashim Lamichhane 3 | PROGRAM: TO FINDOUT ALL THE DIVISOR OF ANY NUMBER 4 | Algorithm: 5 | --------- 6 | Step1: Start 7 | Step2: initialize a variable i=1 and Read any number n 8 | Step3: divide number n by i and check 9 | if number n/i equals to zero 10 | display the divisor is i and go to step4 11 | else 12 | goto step4 13 | Step4: increase i by 1 and check 14 | if i is less than n 15 | go to Step3 16 | else go to step 5 17 | Step5: Stop 18 | 19 | */ 20 | #include 21 | 22 | int main(){ 23 | 24 | int num; 25 | 26 | printf("enter number n"); 27 | scanf("%d",&num); 28 | 29 | for(int i=1;i<=num;i++){ 30 | if(num%i==0){ 31 | printf("the divisor %d\n",i); 32 | } 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /codes/control/palindrome.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int n, reverse = 0, temp; 6 | 7 | printf("Enter a number to check if it is a palindrome or not\n"); 8 | scanf("%d",&n); 9 | 10 | temp = n; 11 | 12 | while( temp != 0 ) 13 | { 14 | reverse = reverse * 10; 15 | reverse = reverse + temp%10; 16 | temp = temp/10; 17 | } 18 | 19 | if ( n == reverse ) 20 | printf("%d is a palindrome number.\n", n); 21 | else 22 | printf("%d is not a palindrome number.\n", n); 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /codes/control/perfectornot.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | @author: Ashim Lamichhane 4 | PROGRAM: TO FINDOUT ALL THE DIVISOR OF ANY NUMBER 5 | 6 | */ 7 | #include 8 | 9 | int main(){ 10 | 11 | int num; 12 | int sum=0; 13 | 14 | printf("enter number: "); 15 | scanf("%d",&num); 16 | 17 | for(int i=1;i 2 | int main () { 3 | /* local variable definition */ 4 | int i, j; 5 | for(i = 2; i<100; i++) { 6 | for(j = 2; j <= (i/j); j++) { 7 | if(!(i%j)) { 8 | break; 9 | } 10 | } 11 | if(j > (i/j)){ 12 | printf("%d is prime\n", i); 13 | } 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /codes/control/primeornot.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Ashim Lamichhane 3 | PROGRAM: DISPLAY IF NUMBER IS PRIME OR NOT 4 | */ 5 | 6 | /* 7 | Step 1: Start 8 | Step 2: Initialize c=0,n and i=1 9 | Step 3: Read any number n 10 | Step 4: Repeat until i<=n else go to Step 7 11 | Step 5: Check if n divided by i leaves remainder 0 12 | then increase c by 1 13 | else: 14 | go to step 6 15 | Step 6: increase counter i by 1 and go to step 4 16 | Step 7: Stop 17 | */ 18 | 19 | #include 20 | int main() { 21 | 22 | int n, i, c = 0; 23 | printf("Enter any number n:"); 24 | scanf("%d", &n); 25 | 26 | for (i=1 ; i <= n; i++) { 27 | if (n % i == 0) { 28 | c++; 29 | } 30 | } 31 | if (c == 2) { 32 | printf("%d is a Prime number\n",n); 33 | } 34 | else { 35 | printf("%d is not a Prime number\n",n); 36 | } 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /codes/control/sumofall.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Ashim Lamichhane 3 | PROGRAM: SUM OF ALL ENTERED NUMBERS 4 | */ 5 | 6 | 7 | #include 8 | 9 | int main(){ 10 | 11 | int num; 12 | int sum=0; 13 | printf("how many numbers do you want to enter??"); 14 | scanf("%d",&num); 15 | 16 | int myarr[num]; 17 | 18 | for(int i=1;i<=num;i++){ 19 | scanf("%d",&myarr[i]); 20 | } 21 | for(int i=1;i<=num;i++){ 22 | sum=sum+myarr[i]; 23 | } 24 | 25 | printf("sum of all entered numbers: %d\n",sum); 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /codes/control/sumofevennumbers.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Ashim Lamichhane 3 | PROGRAM: SUM OF SERIES 4 | */ 5 | 6 | #include 7 | 8 | int main(){ 9 | 10 | int num,sum=0,oddsum=0; 11 | 12 | 13 | printf("enter number n: "); 14 | scanf("%d",&num); 15 | 16 | for(int i=1;i<=num;i++){ 17 | if(i%2==0){ 18 | printf("Even number found: %d\n",i ); 19 | sum=sum+i; 20 | } 21 | else{ 22 | printf("ODD number found: %d\n",i ); 23 | oddsum=oddsum+i; 24 | } 25 | 26 | } 27 | 28 | printf("the Sum of all even numbers from 0 to %d = %d\n",num,sum); 29 | printf("the Sum of all even numbers from 0 to %d = %d\n",num,oddsum); 30 | return 0; 31 | } -------------------------------------------------------------------------------- /codes/control/sumofseries.c: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Ashim Lamichhane 3 | PROGRAM: SUM OF SERIES 4 | */ 5 | 6 | #include 7 | 8 | int main(){ 9 | 10 | int num,sum=0; 11 | 12 | printf("enter number n: "); 13 | scanf("%d",&num); 14 | 15 | for(int i=1;i<=num;i++){ 16 | sum=sum+i; 17 | } 18 | 19 | printf("the Sum of series from 1 to %d is %d\n",num,sum); 20 | return 0; 21 | } -------------------------------------------------------------------------------- /codes/control/switchcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | int bitwise(); 3 | int shiftOperator(); 4 | int evenOrOdd(); 5 | int gcd(); 6 | int perfectorNot(); 7 | int positiveOrNegative(); 8 | int primeOrNot(); 9 | int specialOperator(); 10 | int sumOfAll(); 11 | int sum_of_even_numbers(); 12 | int sum_of_series(); 13 | 14 | int main(void){ 15 | int choice,value; 16 | LOOP: 17 | printf("\n\n\n\n\n"); 18 | printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 19 | printf("~~~~~~~~~~~~~~~~ MY PROGRAM TO FIND WHAT YOU WANT TO DO ~~~~~~~~~~~~~~~~\n"); 20 | // printf("Select 1 for file, 2 for Edit and 3 for Save\n"); 21 | printf("1==> Bitwise Operation\n2==> Shift Operation\n3==> Even Or Odd\n4==> GCD\n5==> PERFECT OR NOT\n6==> POSITIVE OR NEGATIVE\n7==> PRIME OR NOT\n8==> SPECIAL OPERATOR\n9==> SUM OF ALL\n10==> SUM OF EVEN NUMBERS\n11==> SUM OF SERIES\n12==> Sure you don\'t want to spend some time\n"); 22 | printf("\n ENTER YOUR CHOICE: "); 23 | scanf("%d",&choice); 24 | 25 | switch(choice){ 26 | 27 | case 1: 28 | printf("||||||||||||||||||||||||"); 29 | printf("\nBitwise Operation\n"); 30 | printf("||||||||||||||||||||||||"); 31 | bitwise(); 32 | printf("||||||||||||||||||||||||"); 33 | goto LOOP; 34 | 35 | case 2: 36 | printf("||||||||||||||||||||||||"); 37 | printf("\nShift Operation\n"); 38 | printf("||||||||||||||||||||||||"); 39 | shiftOperator(); 40 | printf("||||||||||||||||||||||||"); 41 | goto LOOP; 42 | 43 | case 3: 44 | printf("||||||||||||||||||||||||"); 45 | printf("\nEven Or Odd\n"); 46 | printf("||||||||||||||||||||||||"); 47 | evenOrOdd(); 48 | printf("||||||||||||||||||||||||"); 49 | goto LOOP; 50 | 51 | case 4: 52 | printf("||||||||||||||||||||||||"); 53 | printf("\nGCD\n"); 54 | printf("||||||||||||||||||||||||"); 55 | gcd(); 56 | printf("||||||||||||||||||||||||"); 57 | goto LOOP; 58 | 59 | case 5: 60 | printf("||||||||||||||||||||||||"); 61 | printf("\nPERFECT OR NOT\n"); 62 | printf("||||||||||||||||||||||||"); 63 | perfectorNot(); 64 | printf("||||||||||||||||||||||||"); 65 | goto LOOP; 66 | 67 | case 6: 68 | printf("||||||||||||||||||||||||"); 69 | printf("\nPOSITIVE OR NEGATIVE\n"); 70 | printf("||||||||||||||||||||||||"); 71 | positiveOrNegative(); 72 | printf("||||||||||||||||||||||||"); 73 | goto LOOP; 74 | 75 | case 7: 76 | printf("||||||||||||||||||||||||"); 77 | printf("\nPRIME OR NOT\n"); 78 | printf("||||||||||||||||||||||||"); 79 | primeOrNot(); 80 | printf("||||||||||||||||||||||||"); 81 | goto LOOP; 82 | 83 | case 8: 84 | printf("||||||||||||||||||||||||"); 85 | printf("\nSPECIAL OPERATOR\n"); 86 | printf("||||||||||||||||||||||||"); 87 | specialOperator(); 88 | printf("||||||||||||||||||||||||"); 89 | goto LOOP; 90 | 91 | case 9: 92 | printf("||||||||||||||||||||||||"); 93 | printf("\nSUM OF ALL\n"); 94 | printf("||||||||||||||||||||||||"); 95 | sumOfAll(); 96 | printf("||||||||||||||||||||||||"); 97 | goto LOOP; 98 | 99 | case 10: 100 | printf("||||||||||||||||||||||||"); 101 | printf("\nSUM OF EVEN NUMBERS\n"); 102 | printf("||||||||||||||||||||||||"); 103 | sum_of_even_numbers(); 104 | printf("||||||||||||||||||||||||"); 105 | goto LOOP; 106 | 107 | case 11: 108 | printf("||||||||||||||||||||||||"); 109 | printf("\nSUM OF SERIES\n"); 110 | printf("||||||||||||||||||||||||"); 111 | sum_of_series(); 112 | printf("||||||||||||||||||||||||"); 113 | goto LOOP; 114 | 115 | case 12: 116 | printf("||||||||||||||||||||||||"); 117 | printf("\nBYE BYE :D\n\n"); 118 | printf("||||||||||||||||||||||||\n\n"); 119 | break; 120 | 121 | default: 122 | printf("||||||||||||||||||||||||"); 123 | printf("\n WRONG CHOICE\n"); 124 | printf("\nPLEASE PRESS THE CORRECT OPTION\n\n"); 125 | printf("||||||||||||||||||||||||"); 126 | goto LOOP; 127 | // break; 128 | 129 | } 130 | // return 0; 131 | } 132 | 133 | int bitwise(){ 134 | int n1=60,n2=51,AND, OR, XOR; 135 | AND=n1 & n2; 136 | OR=n1 | n2; 137 | XOR=n1 ^ n2; 138 | printf("\n"); 139 | printf("AND=%d\n",AND ); 140 | printf("OR=%d\n",OR ); 141 | printf("XOR=%d\n",XOR ); 142 | 143 | return 0; 144 | } 145 | int shiftOperator(){ 146 | 147 | unsigned int n1=60 ,left, right; 148 | left =n1 << 3; 149 | right =n1 >> 3; 150 | printf("\n"); 151 | printf("left=%d \n", left); 152 | printf("right=%d\n", right); 153 | printf("ones=%d\n", ~n1 ); 154 | 155 | return 0; 156 | } 157 | int evenOrOdd(){ 158 | int n; 159 | printf("\nEnter Any Number\n"); 160 | scanf("%d",&n); 161 | if(n%2==0){ 162 | printf("The number %d is even\n", n); 163 | } 164 | else{ 165 | printf("The number %d is odd\n", n); 166 | } 167 | 168 | return 0; 169 | } 170 | int gcd(){ 171 | int num; 172 | 173 | printf("\nenter number n"); 174 | scanf("%d",&num); 175 | 176 | for(int i=1;i<=num;i++){ 177 | if(num%i==0){ 178 | printf("the divisor %d\n",i); 179 | } 180 | } 181 | 182 | return 0; 183 | } 184 | int perfectorNot(){ 185 | int num; 186 | int sum=0; 187 | 188 | printf("\nenter number: "); 189 | scanf("%d",&num); 190 | 191 | for(int i=1;i0){ 215 | printf("The number %d is positive\n", n); 216 | } 217 | else{ 218 | printf("The number %d is negative\n", n); 219 | } 220 | 221 | return 0; 222 | } 223 | int primeOrNot(){ 224 | 225 | int n, i, c = 0; 226 | printf("\nEnter any number n:"); 227 | scanf("%d", &n); 228 | 229 | for (i=1 ; i <= n; i++) { 230 | if (n % i == 0) { 231 | c++; 232 | } 233 | } 234 | if (c == 2) { 235 | printf("%d is a Prime number\n",n); 236 | } 237 | else { 238 | printf("%d is not a Prime number\n",n); 239 | } 240 | return 0; 241 | // return 0; 242 | } 243 | int specialOperator(){ 244 | unsigned int n1; 245 | printf("\n"); 246 | printf("Integer Variable => %lu\n",sizeof(n1) ); 247 | printf("Double Constant => %lu\n",sizeof(15.11) ); 248 | printf("Long int Data type qualifier => %lu\n",sizeof(15L) ); 249 | 250 | return 0; 251 | } 252 | int sumOfAll(){ 253 | 254 | int num; 255 | int sum=0; 256 | 257 | printf("\nhow many numbers do you want to enter??"); 258 | scanf("%d",&num); 259 | 260 | int myarr[num]; 261 | 262 | for(int i=1;i<=num;i++){ 263 | scanf("%d",&myarr[i]); 264 | } 265 | for(int i=1;i<=num;i++){ 266 | sum=sum+myarr[i]; 267 | } 268 | 269 | printf("sum of all entered numbers: %d\n",sum); 270 | 271 | return 0; 272 | } 273 | int sum_of_even_numbers(){ 274 | int num,sum=0,oddsum=0; 275 | printf("\n"); 276 | printf("enter number n: "); 277 | scanf("%d",&num); 278 | 279 | for(int i=1;i<=num;i++){ 280 | if(i%2==0){ 281 | printf("Even number found: %d\n",i ); 282 | sum=sum+i; 283 | } 284 | else{ 285 | printf("ODD number found: %d\n",i ); 286 | oddsum=oddsum+i; 287 | } 288 | 289 | } 290 | 291 | printf("the Sum of all even numbers from 0 to %d = %d\n",num,sum); 292 | printf("the Sum of all even numbers from 0 to %d = %d\n",num,oddsum); 293 | 294 | return 0; 295 | } 296 | int sum_of_series(){ 297 | int num,sum=0; 298 | printf("\n"); 299 | printf("enter number n: "); 300 | scanf("%d",&num); 301 | 302 | for(int i=1;i<=num;i++){ 303 | sum=sum+i; 304 | } 305 | 306 | printf("the Sum of series from 1 to %d is %d\n",num,sum); 307 | return 0; 308 | } 309 | 310 | -------------------------------------------------------------------------------- /codes/filehandling/binary.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | FILE *fptr; 6 | char c; 7 | fptr=fopen("read","a+b"); 8 | if(fptr==NULL){ 9 | printf("FILE CAN NOT BE CREATED\n"); 10 | exit(0); 11 | } 12 | fputs("WELCOME TO MY WORLD",fptr); 13 | rewind(fptr); 14 | printf("The content from file: "); 15 | while((c=fgetc(fptr))!=EOF){ 16 | printf("%c", c); 17 | } 18 | printf("\n"); 19 | fclose(fptr); 20 | } -------------------------------------------------------------------------------- /codes/filehandling/directRandomAccess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | struct employee 7 | { 8 | char empName[20]; 9 | int age; 10 | float salary; 11 | }; 12 | struct employee emp; 13 | FILE *fptr; 14 | char yes_no,name[15]; 15 | int dataFound=0; 16 | fptr=fopen("read","w+b"); 17 | if(fptr==NULL){ 18 | printf("FILE CAN NOT BE CREATED\n"); 19 | exit(0); 20 | } 21 | do 22 | { 23 | printf("Employee Name: \t"); 24 | scanf("%s",emp.empName); 25 | printf("Employee Age: \t"); 26 | scanf("%d",&emp.age); 27 | printf("Employee salary: \t"); 28 | scanf("%f",&emp.salary); 29 | 30 | fwrite(&emp,sizeof(emp),1,fptr); 31 | printf("Do you want to add another employee? Press y or Y: \t"); 32 | fflush(stdin); 33 | yes_no=getchar(); 34 | } while (yes_no=='Y' || yes_no=='y'); 35 | 36 | printf("Enter the name of employee which is to be searched:\t"); 37 | fflush(stdin); 38 | gets(name); 39 | rewind(fptr); 40 | 41 | while(fread(&emp,sizeof(emp),1,fptr)==1){ 42 | if (strcmp(emp.empName,name)==0) 43 | { 44 | dataFound=1; 45 | printf("Name\tAge\tSalary\n"); 46 | printf("========================="); 47 | printf("\n%s\t%d\t%.2f",emp.empName,emp.age,emp.salary); 48 | } 49 | 50 | } 51 | if(dataFound==0){ 52 | printf("Matching Document Not found\n"); 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /codes/filehandling/file.txt: -------------------------------------------------------------------------------- 1 | We are in 2012We are in 2012We are in 2012We are in 2012 -------------------------------------------------------------------------------- /codes/filehandling/fprintfFunction.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Write a program to create a file named student.txt 3 | *and write name roll, address and marks of a student to this file 4 | */ 5 | 6 | #include 7 | #include 8 | int main(){ 9 | FILE *f; 10 | char name[20],address[20]; 11 | int roll; 12 | float marks; 13 | char filename[20]; 14 | printf("Enter the name of the file:\t"); 15 | scanf("%s",filename); 16 | 17 | f=fopen(filename,"w"); 18 | 19 | if(f==NULL){ 20 | printf("FILE CANNOT BE CREATED\n"); 21 | exit(0); 22 | } 23 | printf("Enter name of student: \t"); 24 | scanf("%s",name); 25 | printf("Enter roll of student: \t"); 26 | scanf("%d",&roll); 27 | printf("Enter address of student: \t"); 28 | scanf("%s",address); 29 | printf("Enter marks of student: \t"); 30 | scanf("%f",&marks); 31 | 32 | fprintf(f, "Name = %s\nRoll = %d\nAddress = %s\nMarks = %f",name,roll,address,marks); 33 | fclose(f); 34 | } -------------------------------------------------------------------------------- /codes/filehandling/fscanOne.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // The C library function 5 | // void rewind(FILE *stream) sets the file position to the beginning of the file of the given stream. 6 | int main() 7 | { 8 | FILE *fptr; 9 | int i, numFromFile; 10 | fptr=fopen("read","w+"); 11 | if(fptr==NULL){ 12 | printf("FILE CANNOT BE CREATED\n"); 13 | exit(0); 14 | } 15 | for (i = 1; i <=20; i++) 16 | { 17 | fprintf(fptr, "%d\n", i); 18 | } 19 | rewind(fptr); 20 | 21 | printf("The twice of natural number:\n"); 22 | for (int i = 1; i <=20; i++) 23 | { 24 | fscanf(fptr,"%d\n",&numFromFile); 25 | printf("%d\t", numFromFile*2); 26 | } 27 | printf("\n"); 28 | fclose(fptr); 29 | } -------------------------------------------------------------------------------- /codes/filehandling/fscanfFunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // The C library function 5 | // void rewind(FILE *stream) sets the file position to the beginning of the file of the given stream. 6 | 7 | int main() 8 | { 9 | char str1[10], str2[10], str3[10]; 10 | int year; 11 | FILE * fp; 12 | 13 | fp = fopen ("file.txt", "a+b"); 14 | fputs("We are in 2012", fp); 15 | 16 | rewind(fp); 17 | fscanf(fp, "%s %s %s %d", str1, str2, str3, &year); 18 | 19 | printf("Read String1 |%s|\n", str1 ); 20 | printf("Read String2 |%s|\n", str2 ); 21 | printf("Read String3 |%s|\n", str3 ); 22 | printf("Read Integer |%d|\n", year ); 23 | 24 | fclose(fp); 25 | 26 | return(0); 27 | } -------------------------------------------------------------------------------- /codes/filehandling/rambo.txt: -------------------------------------------------------------------------------- 1 | Name = ram 2 | Roll = 33 3 | Address = baneshwor 4 | Marks = 33.000000 -------------------------------------------------------------------------------- /codes/filehandling/read: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | 11 12 | 12 13 | 13 14 | 14 15 | 15 16 | 16 17 | 17 18 | 18 19 | 19 20 | 20 21 | -------------------------------------------------------------------------------- /codes/filehandling/record.c: -------------------------------------------------------------------------------- 1 | /* README 2 | if you run this file, after completing please do run recordRead.c file too to see the result 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | int main(){ 9 | FILE *f; 10 | int num[10],i; 11 | f=fopen("read","wb"); 12 | if(f==NULL){ 13 | printf("FILE CAN NOT BE CREATED\n"); 14 | exit(0); 15 | } 16 | 17 | printf("Enter 10 numbers:\n"); 18 | for (int i = 0; i < 10; i++) 19 | { 20 | scanf("%d",&num[i]); 21 | } 22 | 23 | fwrite(&num,sizeof(num),1,f); 24 | 25 | printf("\n"); 26 | fclose(f); 27 | } -------------------------------------------------------------------------------- /codes/filehandling/recordRead.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | FILE *f; 6 | int num[10]; 7 | f=fopen("read","rb"); 8 | if(f==NULL){ 9 | printf("FILE CAN NOT BE CREATED\n"); 10 | exit(0); 11 | } 12 | 13 | printf("Things read file:\n"); 14 | 15 | fread(&num,sizeof(num),1,f); 16 | 17 | for (int i = 0; i < 10; i++) 18 | { 19 | printf("%d\t",num[i]); 20 | } 21 | 22 | 23 | 24 | printf("\n"); 25 | fclose(f); 26 | } -------------------------------------------------------------------------------- /codes/filehandling/student: -------------------------------------------------------------------------------- 1 | Name=rambo 2 | Roll=23 3 | Address=ktm 4 | Marks=33.000000 -------------------------------------------------------------------------------- /codes/filehandling/test.txt: -------------------------------------------------------------------------------- 1 | Well this is the first file write 2 | What is this now -------------------------------------------------------------------------------- /codes/filehandling/tutorial_i.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void filewrite(){ 5 | FILE *fptr; 6 | 7 | fptr=fopen("/home/ashim/backups/colg/ccodes/codes/filehandling/test.txt","w"); 8 | if(fptr==NULL){ 9 | printf("\nFILE CANNOT BE CREATED"); 10 | exit(0); 11 | } 12 | else{ 13 | printf("File has been successfully created\n"); 14 | } 15 | fputs("Well this is the first file write\nWhat is this now",fptr); 16 | fclose(fptr); 17 | } 18 | void fileread(){ 19 | FILE *fptr; 20 | char s[100]; 21 | fptr=fopen("/home/ashim/backups/colg/ccodes/codes/filehandling/test.txt","r"); 22 | if(fptr==NULL){ 23 | printf("\nFILE CANNOT BE OPENED"); 24 | exit(0); 25 | } 26 | else{ 27 | fgets(s,110,fptr); 28 | printf("This is what we got from file:\t%s\n",s); 29 | fclose(fptr); 30 | } 31 | 32 | } 33 | int main(){ 34 | filewrite(); 35 | fileread(); 36 | 37 | } -------------------------------------------------------------------------------- /codes/filehandling/tutorial_ii.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | 5 | FILE *ccr; 6 | char name[20]; 7 | int i,n; 8 | //int roll[10],percentage; 9 | ccr=fopen("test.txt","w"); 10 | if(ccr==NULL) 11 | { 12 | printf("File cannot be created"); 13 | exit(0); 14 | } 15 | for(i=0;i<=2;i++) 16 | { 17 | printf("Enter the name of the student %d : ",i); 18 | scanf("%s",name); 19 | fprintf(ccr, "Name = %s\n",name); 20 | } 21 | // const char *my_array[] = {"eenie","meenie","miney"}; 22 | 23 | // fprintf(ccr, "Name = %s",name); 24 | // fwrite(name,sizeof(my_array),1,ccr); 25 | fclose(ccr); 26 | return 0; 27 | } 28 | 29 | // #include 30 | 31 | // int main () 32 | // { 33 | // FILE *fp; 34 | // char str[] = "This is tutorialspoint.com"; 35 | 36 | // fp = fopen( "test.txt" , "w" ); 37 | // fwrite(str , 1 , sizeof(str) , fp ); 38 | 39 | // fclose(fp); 40 | 41 | // return(0); 42 | // } -------------------------------------------------------------------------------- /codes/filehandling/tutorial_iii.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void fileread1(char myfilename[]){ 4 | FILE *fptr; 5 | // char filename[20]; 6 | char c; 7 | int n=0; 8 | fptr=fopen(myfilename,"r"); 9 | 10 | if (fptr==NULL) { 11 | printf("\nFILE CANNOT BE OPENED"); 12 | exit(0); 13 | } 14 | else{ 15 | do { 16 | c = fgetc (fptr); 17 | if (c == '$') 18 | { 19 | n++; 20 | } 21 | } while (c != EOF); 22 | fclose (fptr); 23 | printf ("The file contains %d dollar sign characters ($).\n",n); 24 | } 25 | 26 | } 27 | void filewrite(){ 28 | FILE *fptr; 29 | char filename[20]; 30 | char c; 31 | printf("Enter the name of the file:\t"); 32 | scanf("%s",filename); 33 | fptr=fopen(filename,"w"); 34 | printf("\n"); 35 | if(fptr!=NULL){ 36 | printf("\nEnter Text. Hit enter key to stop writing:\t"); 37 | // for (c = 'A' ; c <= 'Z' ; c++){ 38 | // fputc ( c , fptr ); 39 | //} 40 | while((c=getchar())!='\n'){ 41 | fputc(c,fptr); 42 | } 43 | fclose(fptr); 44 | } 45 | //calls fileread function and passes the name of the file 46 | fileread1(filename); 47 | } 48 | 49 | 50 | int main(){ 51 | filewrite(); 52 | // fileread1(); 53 | 54 | } -------------------------------------------------------------------------------- /codes/filehandling/tutorial_iv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | FILE *fptr; 5 | char c; 6 | 7 | fptr=fopen("/home/ashim/backups/colg/ccodes/codes/filehandling/rambo.txt","r"); 8 | if(fptr==NULL){ 9 | printf("FILE CANNOT BE CREATED\n"); 10 | exit(0); 11 | } 12 | while((c=fgetc(fptr))!=EOF){ 13 | printf("%c", c); 14 | } 15 | printf("\n"); 16 | fclose(fptr); 17 | } -------------------------------------------------------------------------------- /codes/filehandling/tutorial_v.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Write a program to read a file named student.txt 3 | *and read name roll, address and marks of a student to this file 4 | */ 5 | 6 | #include 7 | #include 8 | int main(){ 9 | FILE *f; 10 | char name[20],address[20]; 11 | int roll; 12 | float marks; 13 | char filename[20]; 14 | // printf("Enter the name of the file:\t"); 15 | // scanf("%s",filename); 16 | 17 | f=fopen("student","w+"); 18 | 19 | if(f==NULL){ 20 | printf("FILE CANNOT BE CREATED\n"); 21 | exit(0); 22 | } 23 | printf("Enter name of student: \t"); 24 | scanf("%s",name); 25 | printf("Enter roll of student: \t"); 26 | scanf("%d",&roll); 27 | printf("Enter address of student: \t"); 28 | scanf("%s",address); 29 | printf("Enter marks of student: \t"); 30 | scanf("%f",&marks); 31 | 32 | fprintf(f, "Name=%s\nRoll=%d\nAddress=%s\nMarks=%f",name,roll,address,marks); 33 | // fprintf(f, "%s ",name); 34 | fclose(f); 35 | } -------------------------------------------------------------------------------- /codes/function/calculator.c: -------------------------------------------------------------------------------- 1 | #include 2 | int add(int, int); 3 | void sub(int,int); 4 | 5 | void main(){ 6 | int a,b,choice; 7 | printf("Select Any one from the below\n1.Addition\n2. Subtraction\n3. Multiplication \n4. Division\n"); 8 | printf("Enter Any Options(1-4): "); 9 | scanf("%d",&choice); 10 | printf("Enter any Two numbers: "); 11 | scanf("%d%d",&a,&b); 12 | switch(choice){ 13 | case 1: 14 | printf("Your Sum is %d: ",add(a,b)); 15 | break; 16 | case 2: 17 | sub(a,b); 18 | break; 19 | default: 20 | printf("Enter Only Given Options\n"); 21 | } 22 | } 23 | int add(int a, int b){ 24 | return a+b; 25 | } 26 | void sub(int a,int b){ 27 | printf("Your Subtracted value is %d\n",a-b); 28 | } -------------------------------------------------------------------------------- /codes/function/callbyref.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int *x, int *y); /* function declaration */ 3 | 4 | int main () { 5 | int a = 100; int b = 200; /* local variable definition */ 6 | printf("Before swap, value of a : %d\n", a ); 7 | printf("Before swap, value of b : %d\n", b ); 8 | /* calling a function to swap the values. 9 | &a indicates pointer to a ie. address of variable a and 10 | &b indicates pointer to b ie. address of variable b. */ 11 | swap(&a, &b); 12 | printf("After swap, value of a : %d\n", a ); 13 | printf("After swap, value of b : %d\n", b ); 14 | return 0; 15 | } 16 | void swap(int *x, int *y) { /* function definition to swap the values */ 17 | int temp; 18 | temp = *x; /* save the value of address x */ 19 | *x = *y; /* put y into x */ 20 | *y = temp; /* put temp into y */ 21 | // return; 22 | } 23 | -------------------------------------------------------------------------------- /codes/function/callbyreference.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int *,int *); 3 | 4 | int main(void){ 5 | int a=9,b=8; 6 | printf("BEFORE function calling a and b are: %d \t %d\n",a,b); 7 | swap(&a,&b); /* function call by reference*/ 8 | printf("After calling function, a and b are: %d\t %d\n",a,b ); 9 | } 10 | void swap(int *x, int *y){ 11 | int temp; 12 | temp=*x; 13 | *x=*y; 14 | *y=temp; 15 | } 16 | -------------------------------------------------------------------------------- /codes/function/callbyvalue.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int a, int b); /* function prototype */ 3 | 4 | int main(void){ 5 | int a=99,b=98; 6 | 7 | printf("BEFORE function calling a and b are: %d \t %d\n",a,b); 8 | swap(a,b); /* function call by value */ 9 | printf("After calling function, a and b are: %d\t %d\n",a,b ); 10 | 11 | } 12 | 13 | void swap(int x, int y){ 14 | int temp; 15 | temp=x; 16 | x=y; 17 | y=temp; 18 | printf("The values within functions are %d\t%d\n",x,y); 19 | } 20 | -------------------------------------------------------------------------------- /codes/function/caseChanger.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // #define m 5 4 | 5 | char convert(char string[30]){ 6 | for(int i=0;i=97&&string[i]<=122){ 9 | string[i]=string[i]-32; 10 | } 11 | else{ 12 | string[i]=string[i]+32; 13 | } 14 | } 15 | printf("CHANGED: %s\n",string ); 16 | return 0; 17 | } 18 | 19 | int main(void){ 20 | char string[30]; 21 | printf("ENTER STRING: \t"); 22 | scanf("%s",string); 23 | convert(string); 24 | } -------------------------------------------------------------------------------- /codes/function/factorial_rec.c: -------------------------------------------------------------------------------- 1 | #include 2 | long int factorial(int i) { 3 | if(i <= 1) 4 | return 1; 5 | else 6 | return i * factorial(i - 1); 7 | } 8 | int main() { 9 | int i; 10 | printf("Enter any Number: \n"); 11 | scanf("%d",&i); 12 | printf("Factorial of %d is %ld\n", i, factorial(i)); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /codes/function/fib.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fib(int n) 4 | { 5 | if(n==0){ 6 | return 0; 7 | } 8 | else if(n==1){ 9 | return 1; 10 | } 11 | else{ 12 | return ( fib(n-1) + fib(n-2) ); 13 | } 14 | 15 | } 16 | int main() 17 | { 18 | int n,i; 19 | printf("Enter the limit of series"); 20 | scanf("%d",&n); 21 | for(i=0;i<=n;i++) 22 | { 23 | printf(" %d ",fib(i)); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /codes/function/funcsum.c: -------------------------------------------------------------------------------- 1 | /* function definition of add() function which takes two integers and returns 2 | sum of them as integer 3 | */ 4 | 5 | #include 6 | 7 | int add(int a,int b){ 8 | int sum; 9 | sum=a+b; 10 | return sum; 11 | } 12 | 13 | float areaOfCircle(float radius){ 14 | return 3.1428*radius*radius; 15 | } 16 | 17 | int main(){ 18 | int a,b,mysum; 19 | float myfloat; 20 | printf("Enter two numbers\n"); 21 | scanf("%d%d",&a,&b); 22 | mysum=add(a,b); 23 | printf("VALUE: %d\n", mysum); 24 | 25 | myfloat=areaOfCircle(mysum); 26 | printf("So area of circle is: %f\n",myfloat ); 27 | 28 | return 0; 29 | 30 | } -------------------------------------------------------------------------------- /codes/function/function_transpose.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define m 2 4 | #define n 2 5 | int trans[10][10]; 6 | 7 | void matrix(void) 8 | { 9 | int mat[10][10],i,j; 10 | // printf("Enter the number of rows and column "); 11 | // scanf("%d%d",&m,&n); 12 | for(i=0;i 2 | #include 3 | int matrix() 4 | { 5 | int mat[10][10], trans[10][10],m,n,i,j; 6 | printf("Enter the number of rows and column "); 7 | scanf("%d%d",&m,&n); 8 | for(i=0;i 2 | 3 | void recurse ( int count ) /* Each call gets its own copy of count */ 4 | { 5 | printf( "%d\n", count ); 6 | /* It is not necessary to increment count since each function's 7 | variables are separate (so each count will be initialized one greater) 8 | */ 9 | recurse ( count + 1 ); 10 | } 11 | 12 | int main() 13 | { 14 | recurse ( 1 ); /* First function call, so it starts at one */ 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /codes/function/lecturequestions_functions.c: -------------------------------------------------------------------------------- 1 | /* Define a function myPercentage() which calculates the percentage of 2 | the marks in two subjects and marksGotInExams() asks for marks in two 3 | subjects and returns your marks and percentage to the main function. 4 | 5 | */ 6 | 7 | #include 8 | 9 | int total(float a,float b){ 10 | 11 | return a+b; 12 | } 13 | 14 | float percentage(float total){ 15 | 16 | return total/2; 17 | } 18 | 19 | int main(void){ 20 | float a,b,mysum; 21 | float myfloat; 22 | printf("Enter marks in two subjects: \n"); 23 | scanf("%f%f",&a,&b); 24 | mysum=total(a,b); 25 | 26 | printf("My total in two subjects: %.2f\n", mysum); 27 | 28 | myfloat=percentage(mysum); 29 | printf("My percentage is: %.2f \n",myfloat ); 30 | 31 | } -------------------------------------------------------------------------------- /codes/function/power.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | //8. Write a function Power that computes X raised to the power Y for integer X and Y and return double type value. 4 | double power(int,int); 5 | int main () 6 | { 7 | int x,y; 8 | int a,b; 9 | double catch; 10 | printf("Enter Two integers:\n"); 11 | scanf("%d%d",&a,&b); 12 | catch= power(a,b); 13 | printf("Required ans is %e\n",catch); 14 | 15 | } 16 | double power (int x,int y) 17 | { 18 | double p; 19 | p=pow(x,y); 20 | return p; 21 | } 22 | -------------------------------------------------------------------------------- /codes/function/prasuna_twinprime.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | void twin() 6 | { 7 | int j, i, count, add=0; 8 | int a[1000]; 9 | for (j=3; j<500; j++) 10 | { 11 | count = 0; 12 | for(i=2; i 2 | 3 | void count_to_ten ( int count ) 4 | { 5 | /* we only keep counting if we have a value less than ten */ 6 | if ( count < 10 ) 7 | { 8 | printf("\nbefore call %d",count); 9 | count_to_ten( count + 1 ); 10 | printf("\n:after call %d",count); 11 | } 12 | } 13 | int main() 14 | { 15 | count_to_ten ( 0 ); 16 | } 17 | -------------------------------------------------------------------------------- /codes/function/recursive.c: -------------------------------------------------------------------------------- 1 | #include 2 | long int factorial(int i) { 3 | if(i <= 1) { 4 | return 1; 5 | } 6 | 7 | else { 8 | printf("%ld ", i* factorial(i - 1)); 9 | return i * factorial(i - 1); 10 | } 11 | } 12 | int main() { 13 | int i = 5; 14 | printf("fact(i-1)\n"); 15 | printf("Factorial of %d is %ld\n", i, factorial(i)); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /codes/function/roots.c: -------------------------------------------------------------------------------- 1 | /* receives three coefficients a,b,c of quadratic equation ax^2+bx+c=0 as its argument 2 | and then calculates and displays roots */ 3 | #include 4 | #include 5 | 6 | void calculateroot(float ,float,float); 7 | 8 | int main(void){ 9 | float a,b,c; 10 | printf("Enter values of a , b and c: "); 11 | scanf("%f%f%f",&a,&b,&c); 12 | calculateroot(a,b,c); 13 | } 14 | 15 | void calculateroot(float a,float b,float c){ 16 | float under_sq,root1,root2; 17 | under_sq= pow(b,2)-4*a*c; 18 | 19 | if(under_sq>0){ 20 | root1= (-b+sqrt(under_sq))/(2*a); 21 | root2= (-b-sqrt(under_sq))/(2*a); 22 | printf("Roots are: %.2f and %.2f\n",root1 , root2); 23 | } 24 | else if(under_sq==0){ 25 | root1 = root2 = -b/(2*a); 26 | printf("Roots are: %.2f and %.2f\n", root1, root2); 27 | } 28 | else{ 29 | printf("Roots are imaginary\n"); 30 | } 31 | } -------------------------------------------------------------------------------- /codes/function/sorting.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define m 5 3 | void disp(int []); 4 | 5 | int main(void){ 6 | int arr[m],i,j; 7 | printf("Enter 5 numbers\n"); 8 | // printf("size of arr: %lu\n", (sizeof(int))); 9 | for (int i = 0; i < m; i++) 10 | { 11 | scanf("%d",&arr[i]); 12 | } 13 | disp(arr); 14 | } 15 | 16 | void disp(int arr[]){ 17 | for (int i = 0; i < m; i++) 18 | { 19 | for (int j = 0; j < m; j++) 20 | { 21 | if(arr[i]>arr[j]){ 22 | int temp=arr[i]; 23 | arr[i]=arr[j]; 24 | arr[j]=temp; 25 | } 26 | } 27 | } 28 | printf("The sorted list is: "); 29 | for (int i = 0; i < m; i++) 30 | { 31 | printf("%d\t",arr[i]); 32 | } 33 | printf("\n"); 34 | } -------------------------------------------------------------------------------- /codes/function/sum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void disp(int[],int); 4 | int main(void) 5 | { 6 | int arr[5],i; 7 | printf("Enter the values"); 8 | for (i=0;i<5;i++) 9 | { 10 | scanf("%d",&arr[i]); 11 | } 12 | disp(arr,5); 13 | 14 | } 15 | void disp(int ar[],int s){ 16 | int i,sum=0; 17 | printf("Elements are:"); 18 | for (i=0;i 2 | 3 | int natural(int n){ 4 | if(n==0){ 5 | return 0; 6 | } 7 | else{ 8 | return n+natural(n-1); 9 | 10 | } 11 | } 12 | 13 | int main(void){ 14 | int n; 15 | printf("Enter Any Number:\t"); 16 | scanf("%d",&n); 17 | printf("The sum of %d natural numbers is %d\n",n,natural(n) ); 18 | } 19 | -------------------------------------------------------------------------------- /codes/function/swap_i.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int, int); 3 | int main(void){ /* function prototype */ 4 | int a=99,b=98; 5 | printf("BEFORE function calling a and b are: %d \t %d\n",a,b); 6 | swap(a,b); /* function call by value */ 7 | printf("After calling function, a and b are: %d\t %d\n",a,b ); 8 | } 9 | 10 | void swap(int x, int y){ 11 | int temp; 12 | temp=x; 13 | x=y; 14 | y=temp; 15 | printf("The values within functions are %d\t%d\n",x,y); 16 | } -------------------------------------------------------------------------------- /codes/function/swap_ii.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int x, int y); /* function declaration */ 3 | int main () { 4 | int a = 100; int b = 200; /* local variable definition */ 5 | printf("Before swap, value of a : %d\n", a ); 6 | printf("Before swap, value of b : %d\n", b ); 7 | swap(a, b); /* calling a function to swap the values */ 8 | printf("After swap, value of a : %d\n", a ); 9 | printf("After swap, value of b : %d\n", b ); 10 | return 0; 11 | } 12 | /* function definition to swap the values */ 13 | void swap(int x, int y) { 14 | int temp; 15 | temp = x; /* save the value of x */ 16 | x = y; /* put y into x */ 17 | y = temp; /* put temp into y */ 18 | return; 19 | } -------------------------------------------------------------------------------- /codes/function/swap_iii.c: -------------------------------------------------------------------------------- 1 | #include 2 | void swap(int *,int *); 3 | void main(){ 4 | int a=99,b=98; 5 | printf("BEFORE function calling, a and b are: %d\t %d\n",a,b); 6 | swap(&a,&b); /* function call by reference*/ 7 | printf("AFTER calling function, a and b are: %d\t %d\n",a,b ); 8 | } 9 | void swap(int *x, int *y){ 10 | printf("The address of x: %p\n", x); 11 | printf("The address of y: %p\n", y); 12 | int temp; 13 | temp=*x; 14 | printf("The value of temp: %d\n",temp); 15 | *x=*y; 16 | printf("The value of *x: %d\n",*x); 17 | *y=temp; 18 | printf("The value of *y: %d\n",*y); 19 | } -------------------------------------------------------------------------------- /codes/function/toh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * C program for Tower of Hanoi using Recursion 3 | */ 4 | #include 5 | 6 | void towers(int, char, char, char); 7 | 8 | int main() 9 | { 10 | int num; 11 | 12 | printf("Enter the number of disks : "); 13 | scanf("%d", &num); 14 | printf("The sequence of moves involved in the Tower of Hanoi are :\n"); 15 | towers(num, 'A', 'C', 'B'); 16 | return 0; 17 | } 18 | void towers(int num, char frompeg, char topeg, char auxpeg) 19 | { 20 | if (num == 1) 21 | { 22 | printf("Move disk 1 from peg %c to peg %c\n", frompeg, topeg); 23 | return; 24 | } 25 | towers(num - 1, frompeg, auxpeg, topeg); 26 | printf("Move disk %d from peg %c to peg %c\n", num, frompeg, topeg); 27 | towers(num - 1, auxpeg, topeg, frompeg); 28 | } -------------------------------------------------------------------------------- /codes/function/whatisyourname.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Global Variable Declaration 4 | char s[10]; 5 | 6 | char* without_an_argument() // OR char return_and_pass(char *s) 7 | { 8 | printf("Enter Your Name: "); 9 | scanf("%s",s); 10 | return s; 11 | } 12 | 13 | char* with_an_argument(char *s){ 14 | printf("Enter Your Name: "); 15 | scanf("%s",s); 16 | return s; 17 | } 18 | 19 | void call_with_argument(){ 20 | char *c; 21 | char d[10]; 22 | c=with_an_argument(d); 23 | printf("The Name is %s\n",c); 24 | } 25 | 26 | void call_without_argument(){ 27 | char *c; 28 | c=without_an_argument(); 29 | printf("The Name is %s\n",c); 30 | } 31 | 32 | int main() 33 | { 34 | int i; 35 | printf("1. To Pass string as an arguement\n2. To Pass string without an arguement\n\nEnter Your Choice: "); 36 | scanf("%d",&i); 37 | switch(i){ 38 | case 1: 39 | // Call with passing String 40 | call_with_argument(); 41 | break; 42 | case 2: 43 | // call without passing String 44 | call_without_argument(); 45 | break; 46 | 47 | default: 48 | printf("You Entered Incorrect Choice\nHave A Nice Day :)\n"); 49 | } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /codes/logial/C_Assignment_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/codes/logial/C_Assignment_3.pdf -------------------------------------------------------------------------------- /codes/logial/README.md: -------------------------------------------------------------------------------- 1 | If anyone is interested try to do question number 3 and 4. 2 | 3 | Good Luck :) 4 | -------------------------------------------------------------------------------- /codes/operator/bitwise.c: -------------------------------------------------------------------------------- 1 | #include 2 | // #include 3 | 4 | int main(){ 5 | 6 | int n1=60,n2=51,AND, OR, XOR; 7 | AND=n1 & n2; 8 | OR=n1 | n2; 9 | XOR=n1 ^ n2; 10 | 11 | printf("AND=%d\n",AND ); 12 | printf("OR=%d\n",OR ); 13 | printf("XOR=%d\n",XOR ); 14 | 15 | } -------------------------------------------------------------------------------- /codes/operator/break.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main () { 3 | /* local variable definition */ 4 | int a = 10; 5 | /* while loop execution */ 6 | while( a < 20 ) { 7 | printf("value of a: %d\n", a); 8 | a++; 9 | if( a > 15) 10 | { 11 | /* terminate the loop using break statement */ 12 | break; 13 | } 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /codes/operator/exitexample.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main () 5 | { 6 | printf("Start of the program....\n"); 7 | 8 | printf("Exiting the program....\n"); 9 | exit(0); 10 | // break; 11 | 12 | printf("End of the program....\n"); 13 | 14 | return(0); 15 | } -------------------------------------------------------------------------------- /codes/operator/positiveornegative.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int n; 5 | printf("Enter Any Number\n"); 6 | scanf("%d",&n); 7 | if(n==0 ||n==-0){ 8 | printf("The number %d is neither positive or negative\n", n); 9 | } 10 | else if(n>0){ 11 | printf("The number %d is positive\n", n); 12 | } 13 | else{ 14 | printf("The number %d is negative\n", n); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /codes/operator/prime.c: -------------------------------------------------------------------------------- 1 | #include 2 | // prime number less than 500 3 | int prime() 4 | { 5 | int i,j; 6 | int n=0; 7 | for(i=2;i<500;i++) 8 | { 9 | for(j=1;j<=i;j++){ 10 | if(i%j==0){ 11 | n++; 12 | } 13 | } 14 | if(n==2){ 15 | printf("%d\t",i); 16 | } 17 | n=0; 18 | } 19 | return 0; 20 | } 21 | int main(void) 22 | { 23 | 24 | prime(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /codes/operator/shiftoperator.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | unsigned int n1=60 ,left, right; 5 | left =n1 << 3; 6 | right =n1 >> 3; 7 | 8 | printf("left=%d \n", left); 9 | printf("right=%d\n", right); 10 | printf("ones=%d\n", ~n1 ); 11 | } 12 | -------------------------------------------------------------------------------- /codes/operator/specialoperator.c: -------------------------------------------------------------------------------- 1 | #include 2 | // #include 3 | 4 | int main(){ 5 | 6 | unsigned int n1; 7 | 8 | printf("Integer Variable => %lu\n",sizeof(n1) ); 9 | printf("Double Constant => %lu\n",sizeof(15.11) ); 10 | printf("Long int Data type qualifier => %lu\n",sizeof(15L) ); 11 | } -------------------------------------------------------------------------------- /codes/pointer/addmatrices.c: -------------------------------------------------------------------------------- 1 | // Write a program to add two m*n matrices using pointer. 2 | #include 3 | #include 4 | #define m 2 5 | #define n 2 6 | 7 | int main(){ 8 | int (*a)[n]=malloc(sizeof(*a) * m); 9 | int (*b)[n]=malloc(sizeof(*b) * m); 10 | int (*sum)[n]=malloc(sizeof(*sum) * m);; 11 | // int a[m][n]; 12 | // int x[m][n]; 13 | // int sum[m][n]; 14 | int i,j; 15 | 16 | printf("Enter first matrix:\n"); 17 | for(i=0;i 3 | int main(void){ 4 | float marks[10],sum=0; 5 | int i; 6 | float avg; 7 | printf("Enter marks of 10 students: "); 8 | for(i=0;i<10;i++){ 9 | // printf("%p",marks+i); 10 | scanf("%f",marks+i); 11 | sum+=*(marks+i); 12 | } 13 | avg=sum/10; 14 | printf("\nThe average is=%f\n", avg); 15 | } -------------------------------------------------------------------------------- /codes/pointer/caseChanger.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void conversion(char *); 4 | 5 | int main(){ 6 | char input; 7 | printf("Enter character of your choice: "); 8 | scanf("%c",&input); 9 | 10 | conversion(&input); 11 | printf("The corresponding character is: %c\n",input ); 12 | } 13 | 14 | 15 | void conversion(char *c){ 16 | if (*c>=97 && *c<=122) 17 | { 18 | *c=*c-32; 19 | } 20 | else if(*c >=65 && *c<=90){ 21 | *c=*c+32; 22 | } 23 | } -------------------------------------------------------------------------------- /codes/pointer/copyAnArrayOfDouble.c: -------------------------------------------------------------------------------- 1 | // 2065 BscCSIT Q.no 8 2 | // Write a program that uses pointers to copy an array of double. 3 | 4 | #include 5 | #include 6 | // #define m 7 7 | double * copy(double *arr, int size) { 8 | int i; 9 | double *new_arr = malloc(sizeof(double) * size); 10 | for(i=0;i 2 | int main() 3 | { 4 | int num=123; 5 | 6 | /*Pointer for num*/ 7 | int *pr2; 8 | 9 | /*Double pointer for pr2*/ 10 | int **pr1; 11 | 12 | /* I’m reading the address of variable num and 13 | * storing it in pointer pr2*/ 14 | pr2 = # 15 | 16 | /* storing the address of pointer pr2 into another pointer pr1*/ 17 | pr1 = &pr2; 18 | 19 | /* Possible ways to find value of variable num*/ 20 | printf("\n Value of num is: %d", num); 21 | printf("\n Value of num using pr2 is: %d", *pr2); 22 | printf("\n Value of num using pr1 is: %d", **pr1); 23 | 24 | /*Possible ways to find address of num*/ 25 | printf("\n Address of num is: %p", &num); 26 | printf("\n Address of num using pr2 is: %p", pr2); 27 | printf("\n Address of num using pr1 is: %p", *pr1); 28 | 29 | /*Find value of pointer*/ 30 | printf("\n Value of Pointer pr2 is: %p", pr2); 31 | printf("\n Value of Pointer pr2 using pr1 is: %p", *pr1); 32 | 33 | /*Ways to find address of pointer*/ 34 | printf("\n Address of Pointer pr2 is:%p",&pr2); 35 | printf("\n Address of Pointer pr2 using pr1 is:%p",*pr1); 36 | 37 | /*Double pointer value and address*/ 38 | printf("\n Value of Pointer pr1 is:%p",pr1); 39 | printf("\n Address of Pointer pr1 is:%p\n",&pr1); 40 | 41 | return 0; 42 | } -------------------------------------------------------------------------------- /codes/pointer/marksOfStudents.c: -------------------------------------------------------------------------------- 1 | /* 2 | WAP to read number of students and then marks of each student and print average 3 | */ 4 | #include 5 | #include 6 | #include 7 | 8 | int main(){ 9 | int n,i; 10 | float *p,sum=0,avg; 11 | printf("How many students are there?\t" ); 12 | scanf("%d",&n); 13 | printf("Enter Marks of each Student\n"); 14 | 15 | p=(float *)malloc(n*sizeof(float)); 16 | 17 | for (int i = 0; i < n; i++) 18 | { 19 | scanf("%f",p+i); 20 | sum+=*(p+i); 21 | } 22 | avg=sum/n; 23 | 24 | printf("\nThe average marks of"); 25 | for (int i = 0; i < n; i++) 26 | { 27 | printf(" %.2f ",*(p+i) ); 28 | } 29 | printf(" is: %.2f\n", avg); 30 | free(p); 31 | 32 | } -------------------------------------------------------------------------------- /codes/pointer/maxmin.c: -------------------------------------------------------------------------------- 1 | //WAP a program to read an array of n integers using dynamic memory allocation and display the largest and smallest element 2 | #include 3 | #include 4 | 5 | int main(void){ 6 | int n,i; 7 | int *num,max,min; 8 | 9 | printf("Enter number of elements in your array: \t"); 10 | scanf("%d",&n); 11 | num=(int *)calloc(n,sizeof(int)); 12 | printf("Enter %d elements: ", n); 13 | for(i = 0; i < n; i++) 14 | { 15 | scanf("%d",num+i); 16 | } 17 | max=*num; 18 | min=*num; 19 | // printf("max=%d min=%d\n",max,min ); 20 | for(i = 0; i < n; i++) 21 | { 22 | if(max < *(num+i)){ 23 | max=*(num+i); 24 | } 25 | if (min > *(num+i)) 26 | { 27 | min=*(num+i); 28 | } 29 | } 30 | printf("\nThe Max number is: %d\n",max); 31 | printf("\nThe Min number is: %d\n",min); 32 | } -------------------------------------------------------------------------------- /codes/pointer/memory.c: -------------------------------------------------------------------------------- 1 | /* A program to display memory location reserved by a variable */ 2 | #include 3 | int main(){ 4 | int a=20; 5 | int *p=&a; 6 | printf("The address of a is: %p\n", p); 7 | printf("The value of a is: %d\n", *p); 8 | return 0; 9 | 10 | } -------------------------------------------------------------------------------- /codes/pointer/memory1.c: -------------------------------------------------------------------------------- 1 | /* A program to illustrate addresses reserved by different data types */ 2 | #include 3 | int main() 4 | { 5 | /* code */ 6 | int a=20, b=50; 7 | float c=10.4; 8 | char d='A'; 9 | printf("The Base Address of a is: %p\n", &a); 10 | printf("The Base Address of b is: %p\n", &b); 11 | printf("The Base Address of c is: %p\n", &c); 12 | printf("The Base Address of d is: %p\n", &d); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /codes/pointer/memory3.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | /* code */ 5 | int v=10, *p; 6 | p=&v; 7 | printf("address of v=%p \n",&v ); 8 | 9 | printf("address of v=%p \n",p ); 10 | 11 | printf("value of v=%d \n",v ); 12 | printf("value of v=%d \n",*p ); 13 | 14 | printf("address of p=%p \n",&p ); 15 | 16 | } -------------------------------------------------------------------------------- /codes/pointer/nullpoint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int *p=NULL; 5 | int a,b; 6 | printf("%p\n",&p); 7 | printf("%d\n",a/b); 8 | } -------------------------------------------------------------------------------- /codes/pointer/one_array_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int x[5]={20,40,60,80,100},k; 6 | printf("\narray element \t\telements value \t\taddress\n"); 7 | for(k=0;k<5;k++){ 8 | printf("x[%d]\t\t\t%d\t\t\t%p\n",k,*(x+k),x+k ); 9 | } 10 | } 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /codes/pointer/passpointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void addGraceMarks(int *m){ 4 | 5 | *m=*m+10; 6 | 7 | } 8 | 9 | int main(void){ 10 | int marks; 11 | printf("Enter Actual Marks\n"); 12 | scanf("%d",&marks); 13 | addGraceMarks(&marks); 14 | printf("\nThe grace marks is : %d\n",marks); 15 | 16 | } -------------------------------------------------------------------------------- /codes/pointer/pointer_sub.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int a[]={45,89,54,29},*pf,*p1; 5 | p1=a; 6 | pf=a+2; 7 | printf("pf=%p\n",pf ); 8 | printf("p1=%p\n",p1 ); 9 | printf("So pf-p1=%ld\n",pf-p1 ); 10 | 11 | if(p1>pf){ 12 | printf("p1 is larger one\n"); 13 | } 14 | else{ 15 | printf("pf is larger lol stupid comparison\n"); 16 | } 17 | } -------------------------------------------------------------------------------- /codes/pointer/pointerarray.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* function declaration */ 4 | double getAverage(int *arr, int size); 5 | 6 | int main () { 7 | 8 | /* an int array with 5 elements */ 9 | int balance[5] = {1000, 2, 3, 17, 50}; 10 | double avg; 11 | 12 | /* pass pointer to the array as an argument */ 13 | avg = getAverage( balance, 5 ) ; 14 | 15 | /* output the returned value */ 16 | printf("Average value is: %f\n", avg ); 17 | return 0; 18 | } 19 | 20 | double getAverage(int *arr, int size) { 21 | 22 | int i, sum = 0; 23 | double avg; 24 | 25 | for (i = 0; i < size; ++i) { 26 | sum += arr[i]; 27 | } 28 | 29 | avg = (double)sum / size; 30 | return avg; 31 | } -------------------------------------------------------------------------------- /codes/pointer/reallocation.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main(){ 5 | char *name; 6 | name=(char *)malloc(11); 7 | 8 | strcpy(name,"Ram Dev"); 9 | printf("\nName=%s\n", name); 10 | 11 | name=(char *)realloc(name,23); 12 | strcpy(name,"Mr. Ramdev Baba"); 13 | printf("Name=%s\n",name ); 14 | 15 | } -------------------------------------------------------------------------------- /codes/pointer/relationship1darray.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void relationship(); 4 | int main(void){ 5 | relationship(); 6 | } 7 | 8 | void relationship(){ 9 | int x[10]; 10 | printf("\nThe address of first index is= %p\n", &x[0]); 11 | printf("\nThe address of first index is= %p\n", x); 12 | 13 | printf("\nThe address of second index is= %p\n", &x[1]); 14 | printf("\nThe address of second index is= %p\n", x+1); 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /codes/pointer/reverseOrderWithoutReturn.c: -------------------------------------------------------------------------------- 1 | // Q no 8. BSCcsit 2066 2 | /* Write a function that is passed an array of n pointers to floats 3 | and returns a newly created array that contains those n float values in reverse order. */ 4 | 5 | #include 6 | #include 7 | 8 | float reverse(float *addr,int n); 9 | 10 | int main(){ 11 | int size; 12 | 13 | //ask user to enter the size of an array 14 | printf("Enter Size of an array: \t"); 15 | scanf("%d",&size); 16 | 17 | //declaring the size of an array 18 | float *myarr=(float *)malloc(sizeof(float) * size); 19 | // float *catcharray=(float *)malloc(sizeof(float) * size); 20 | 21 | //take input from user 22 | for(int i=0;i=0;i--,j++){ 34 | myrev[j]=*(addr+i); 35 | printf("%d\t\t%.2f\t\t%p\n",j,*(myrev+j),myrev+j); 36 | } 37 | return 0; 38 | 39 | } 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /codes/pointer/reverseWithReturn.c: -------------------------------------------------------------------------------- 1 | // Q no 8. BSCcsit 2066 2 | /* Write a function that is passed an array of n pointers to floats 3 | and returns a newly created array that contains those n float values in reverse order. */ 4 | 5 | #include 6 | #include 7 | // #define m 7 8 | float * returnArray(float *arr, int size) { 9 | float *new_arr = malloc(sizeof(float) * size); 10 | for(int i = size-1,j=0;i>=0; i--,j++) { 11 | new_arr[j] = arr[i]; 12 | } 13 | return new_arr; 14 | } 15 | 16 | int main() { 17 | int size; 18 | printf("Enter Size of an array: \t"); 19 | scanf("%d",&size); 20 | 21 | float arr[size]; 22 | for(int i=0;i -------------------------------------------------------------------------------- /codes/pointer/sizeOfPointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main(){ 4 | int * pointer; 5 | printf("size of int pointer: %ld\n",sizeof(pointer)); 6 | void *vptr; 7 | printf("size of void pointer: %ld\n",sizeof(vptr)); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /codes/pointer/sortUsingPointer.c: -------------------------------------------------------------------------------- 1 | // Write a program to sort 'n' numbers in ascending order using dynamic memory. 2 | #include 3 | #include 4 | 5 | void get(float *,int); 6 | void sort(float *,int); 7 | void display(float *,int); 8 | 9 | int main(){ 10 | int size; 11 | printf("Enter the size of an array: \t"); 12 | scanf("%d",&size); 13 | float *arr=(float *)malloc(size*sizeof(float)); 14 | 15 | get(arr,size); 16 | sort(arr,size); 17 | display(arr,size); 18 | } 19 | 20 | void get(float *arr,int size){ 21 | printf("Enter %d numbers: \t", size); 22 | for (int i = 0; i < size; i++) 23 | { 24 | scanf("%f",arr+i); 25 | } 26 | } 27 | 28 | void sort(float *arr,int size){ 29 | float temp; 30 | int i,j; 31 | for (int i = 0; i < size; i++) 32 | { 33 | for (int j = 0; j < size; j++) 34 | { 35 | if(*(arr+i)<*(arr+j)){ 36 | 37 | temp=*(arr+i); 38 | *(arr+i)=*(arr+j); 39 | *(arr+j)=temp; 40 | } 41 | } 42 | } 43 | } 44 | 45 | void display(float *arr,int size){ 46 | printf("Sorted array: \t"); 47 | for (int i = 0; i < size; i++) 48 | { 49 | printf("%.2f\n", *(arr+i)); 50 | } 51 | } -------------------------------------------------------------------------------- /codes/pointer/sumOfNnumbers.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Write a program to display element with their address using array name as a pointer 4 | 5 | */ 6 | #include 7 | #include 8 | #define m 2 9 | 10 | void firstMethod(); 11 | void secondMethod(); 12 | 13 | int main(void) 14 | { 15 | //You can use both two methods but use one at a time and see the difference 16 | firstMethod(); 17 | secondMethod(); 18 | 19 | } 20 | void firstMethod(){ 21 | //Here we have declared a pointer array and defined its size 22 | int (*arr)[m]=malloc(sizeof(*arr)*m); 23 | // int arr[5]; 24 | printf("Enter the values"); 25 | for (int i=0;i<5;i++) 26 | { 27 | //here we store values accordingly since we are dealing with values we keep * 28 | scanf("%d",*(arr+i)); 29 | 30 | } 31 | printf("\n"); 32 | for (int i=0;i<5;i++) 33 | { 34 | printf("%d\t",*(*(arr+i))); 35 | } 36 | } 37 | 38 | void secondMethod(){ 39 | // Here we declare array in conventional format 40 | int arr[5]; 41 | printf("Enter the values"); 42 | for (int i=0;i<5;i++) 43 | { 44 | // here we keep value in the memory address 45 | scanf("%d",arr+i); 46 | 47 | } 48 | printf("\n"); 49 | for (int i=0;i<5;i++) 50 | { 51 | //We can simply extract the value by puting * in front 52 | printf("%d\t",*(arr+i)); 53 | } 54 | } -------------------------------------------------------------------------------- /codes/pointer/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define m 7 5 | float * returnArray(float *arr, int size) { 6 | float *new_arr = malloc(sizeof(float) * size); 7 | for(int i = size-1,j=0;i>=0; i--,j++) { 8 | new_arr[j] = arr[i]; 9 | } 10 | return new_arr; 11 | } 12 | 13 | int main() { 14 | 15 | int i,j; 16 | char str1[10],str2[10]; 17 | printf("Enter first String\n"); 18 | scanf("%s",str1); 19 | 20 | printf("Enter second String\n"); 21 | scanf("%s",str2); 22 | 23 | // printf("%lu\n",strlen(str1) ); 24 | for(i=0;i 4 | 5 | int main(void){ 6 | int p[2][3]={{1,2,3},{4,5,6}}; 7 | printf("\np[2][3]={{1,2,3},{4,5,6}}\n"); 8 | printf("\n\np=%p \tp+1=%p\n",p,p+1); 9 | printf("\n*p=%p\t*(p+1)=%p\n",*p,*(p+1)); 10 | printf("\n*(p+0)+1=%p\t*(p+1)+1=%p\n",*(p+0)+1,*(p+1)+1); 11 | printf("\n*(*(p+0)+1)=%d\t\t*(*(p+1)+1)=%d\n\n",*(*(p+0)+1),*(*(p+1)+1)); 12 | 13 | } -------------------------------------------------------------------------------- /codes/pointer/void_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int a=10; 5 | double b=4.5; 6 | void *vptr; 7 | 8 | vptr=&a; 9 | printf("a=%d\n", *((int *)vptr)); /* not just simply *vptr */ 10 | vptr=&b; 11 | printf("\nb=%lf\n", *((double *)vptr)); 12 | } 13 | -------------------------------------------------------------------------------- /codes/structure/accounts.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct account { // Account Structure 4 | int id; 5 | int money; 6 | char name[30]; 7 | }; 8 | 9 | int number; 10 | 11 | 12 | void main() { 13 | int id,x,input_money; 14 | char name[50]; 15 | struct account accountarray[50]; 16 | 17 | printf("How many Number of accounts do you want to enter? "); 18 | scanf("%d",&x); 19 | printf("--Make Account--\n"); 20 | for (int i = 0; i < x; i++) 21 | { 22 | 23 | printf("Input ID : "); 24 | scanf("%d", &accountarray[i].id); 25 | printf("Insert Money : "); 26 | scanf("%d", &accountarray[i].money); 27 | printf("Your Name? : "); 28 | scanf("%s", accountarray[i].name); 29 | printf("\n"); 30 | } 31 | printf("****RECORD INSERTED****\n"); 32 | for (int i = 0; i < x; i++) 33 | { 34 | printf("\nID: %d",accountarray[i].id); 35 | printf("\nNAME: %s",accountarray[i].name); 36 | printf("\nMONEY: %d",accountarray[i].money); 37 | 38 | 39 | } 40 | 41 | 42 | // accountarray[number++] = NULL; // I think there's a problem in this side 43 | // accountarray[number++]->id = id; 44 | // accountarray[number++]->money = input_money; 45 | // *accountarray[number++]->name = name; 46 | } -------------------------------------------------------------------------------- /codes/structure/arrayStruct.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define B 2 3 | 4 | struct student { 5 | char name[50]; 6 | int roll; 7 | float marks; 8 | }; 9 | 10 | int main() { 11 | struct student s[B]; 12 | printf("Enter information of students:\n"); 13 | for(int i=0; i 2 | #include 3 | //------------------------------------- 4 | struct Example 5 | { 6 | int num1; 7 | int num2; 8 | }s[3]; 9 | //------------------------------------- 10 | void accept(struct Example sptr[],int n) 11 | { 12 | int i; 13 | for(i=0;i 2 | #include 3 | 4 | struct student_college_detail 5 | { 6 | int college_id; 7 | char college_name[50]; 8 | }; 9 | 10 | struct student_detail 11 | { 12 | int id; 13 | char name[20]; 14 | float percentage; 15 | // structure within structure 16 | struct student_college_detail clg_data; 17 | }stu_data; 18 | 19 | int main() 20 | { 21 | struct student_detail stu_data = {1, "Raju", 90.5, 71145, 22 | "Anna University"}; 23 | 24 | printf(" Id is: %d \n", stu_data.id); 25 | printf(" Name is: %s \n", stu_data.name); 26 | printf(" Percentage is: %f \n", stu_data.percentage); 27 | 28 | printf(" College Id is: %d \n", 29 | stu_data.clg_data.college_id); 30 | printf(" College Name is: %s \n", 31 | stu_data.clg_data.college_name); 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /codes/structure/neststruct.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct Employee 4 | { 5 | char ename[20]; 6 | int id; 7 | float salary; 8 | struct date 9 | { 10 | int date; 11 | int month; 12 | int year; 13 | }doj; 14 | }emp = {"Pritesh",1000,1000.50,{22,6,1990}}; 15 | 16 | int main() 17 | { 18 | printf("\n\n\n"); 19 | printf("\nEmployee Name : %s",emp.ename); 20 | printf("\nEmployee SSN : %d",emp.id); 21 | printf("\nEmployee Salary : %f",emp.salary); 22 | printf("\nEmployee DOB : %d/%d/%d", \ 23 | emp.doj.date,emp.doj.month,emp.doj.year); 24 | printf("\n\n\n"); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /codes/structure/pointerToStruct.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void){ 5 | struct book 6 | { 7 | char name[50]; 8 | int pages; 9 | float price; 10 | }; 11 | struct book b,*bptr; 12 | printf("Enter Book's name:\t"); 13 | scanf("%s",b.name); 14 | 15 | printf("Number of Pages: \t"); 16 | scanf("%d",&b.pages); 17 | 18 | printf("Enter Price: \t"); 19 | scanf("%f",&b.price); 20 | bptr=&b; 21 | printf("\n\n\n"); 22 | printf("Book name:\tPages:\tPrice\n"); 23 | // printf("\n\nBook Info Using Pointer i.e arrow operator\n\n"); 24 | printf("\n%s\t\t%d\t%.2f\tBook Info Using Pointer i.e arrow operator\n",bptr->name,bptr->pages,bptr->price); 25 | 26 | // printf("\n\nBook Info Using Pointer i.e *Operator\n\n"); 27 | printf("\n%s\t\t%d\t%.2f\tBook Info Using Pointer i.e *Operator\n",(*bptr).name,(*bptr).pages,(*bptr).price); 28 | 29 | // printf("\n\nBook Info Using Structure variable i.e dot operator\n\n"); 30 | printf("\n%s\t\t%d\t%.2f\tBook Info Using Structure variable i.e dot operator\n",b.name,b.pages,b.price); 31 | printf("\n\n\n"); 32 | } -------------------------------------------------------------------------------- /codes/structure/strucMemTofunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void display(char empName[], int id, float sa1){ 5 | printf("Name: %s\n", empName); 6 | // printf("%s\n",empName); 7 | printf("Employee id%d\n",id); 8 | printf("Salary: %.1f\n",sa1); 9 | } 10 | 11 | void main(){ 12 | struct employee 13 | { 14 | char name[20]; 15 | int id; 16 | float salary; 17 | }; 18 | struct employee emp; 19 | 20 | printf("Employee Name:\t"); 21 | scanf("%s",emp.name); 22 | 23 | printf("Employee id:\t"); 24 | scanf("%d",&emp.id); 25 | 26 | printf("Salary of the Employee:\t"); 27 | scanf("%f",&emp.salary); 28 | 29 | display(emp.name,emp.id,emp.salary); 30 | 31 | } -------------------------------------------------------------------------------- /codes/structure/structToFunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct employee 5 | { 6 | char name[20]; 7 | int id; 8 | float salary; 9 | }; 10 | 11 | void display(struct employee e){ 12 | printf("Name: %s\n", e.name); 13 | printf("Employee id%d\n",e.id); 14 | printf("Salary: %.1f\n",e.salary); 15 | } 16 | 17 | void main(){ 18 | 19 | struct employee emp; 20 | 21 | printf("Employee Name:\t"); 22 | scanf("%s",emp.name); 23 | 24 | printf("Employee id:\t"); 25 | scanf("%d",&emp.id); 26 | 27 | printf("Salary of the Employee:\t"); 28 | scanf("%f",&emp.salary); 29 | 30 | display(emp); 31 | 32 | } -------------------------------------------------------------------------------- /codes/structure/structwithDMA.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct name { 4 | int a; 5 | char c[30]; 6 | }; 7 | int main(){ 8 | struct name *ptr; 9 | int i,n; 10 | printf("Enter n: "); 11 | scanf("%d",&n); 12 | 13 | /* Allocates the memory for n structures with pointer ptr pointing to the base address. */ 14 | ptr=(struct name*)malloc(n*sizeof(struct name)); 15 | for(i=0;ic, &(ptr+i)->a); 18 | } 19 | printf("\n\nDisplaying Infromation:\nName\tRoll Number\n\n"); 20 | for(i=0;ic,(ptr+i)->a); 22 | return 0; 23 | } -------------------------------------------------------------------------------- /codes/structure/stucPointerToFunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct employee 4 | { 5 | char name[20]; 6 | int id; 7 | float salary; 8 | }; 9 | 10 | void display(struct employee e){ 11 | printf("Name: %s\n", e.name); 12 | printf("Employee id%d\n",e.id); 13 | printf("Salary: %.1f\n",e.salary); 14 | } 15 | 16 | void increaseSalary(struct employee *ee){ 17 | ee->salary=ee->salary+1000; 18 | } 19 | 20 | void main(){ 21 | 22 | struct employee emp; 23 | 24 | printf("Employee Name:\t"); 25 | scanf("%s",emp.name); 26 | 27 | printf("Employee id:\t"); 28 | scanf("%d",&emp.id); 29 | 30 | printf("Salary of the Employee:\t"); 31 | scanf("%f",&emp.salary); 32 | increaseSalary(&emp); 33 | display(emp); 34 | } -------------------------------------------------------------------------------- /codes/structure/tutorial_i.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct student 5 | { 6 | int id; 7 | char name[20]; 8 | float percentage; 9 | }; 10 | 11 | int main() 12 | { 13 | struct student record = {0}; //Initializing to null 14 | 15 | record.id=419; 16 | strcpy(record.name, "ragas"); 17 | printf("Enter percentage:\t"); 18 | scanf("%f",&record.percentage); 19 | // record.percentage = 39.5; 20 | 21 | printf(" Id is: %d \n", record.id); 22 | printf(" Name is: %s \n", record.name); 23 | printf(" Percentage is: %f \n", record.percentage); 24 | return 0; 25 | } -------------------------------------------------------------------------------- /codes/structure/tutorial_ii.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct student 5 | { 6 | int id; 7 | char name[20]; 8 | float percentage; 9 | }; 10 | 11 | 12 | int main() 13 | { 14 | struct student record; 15 | 16 | record.id=419; 17 | strcpy(record.name, "ragas"); 18 | record.percentage = 39.5; 19 | 20 | printf(" Id is: %d \n", record.id); 21 | printf(" Name is: %s \n", record.name); 22 | printf(" Percentage is: %f \n", record.percentage); 23 | return 0; 24 | } -------------------------------------------------------------------------------- /codes/structure/tutorial_iii.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | struct student 5 | { 6 | int id; 7 | char name[20]; 8 | float percentage; 9 | }record; 10 | 11 | 12 | int main() 13 | { 14 | struct student record = {0}; //Initializing to null 15 | 16 | record.id=419; 17 | strcpy(record.name, "ragas"); 18 | printf("Enter percentage:\t"); 19 | scanf("%f",&record.percentage); 20 | if (record.percentage>100) 21 | { 22 | printf("Percentage Cannot be greater than 100\n"); 23 | exit(0); 24 | } 25 | 26 | printf(" Id is: %d \n", record.id); 27 | printf(" Name is: %s \n", record.name); 28 | printf(" Percentage is: %f \n", record.percentage); 29 | return 0; 30 | } -------------------------------------------------------------------------------- /codes/structure/tutorial_iv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct Books { 5 | char title[50]; 6 | char author[50]; 7 | char subject[100]; 8 | int book_id; 9 | }; 10 | 11 | /* function declaration */ 12 | void printBook( struct Books book ); 13 | 14 | int main( ) { 15 | 16 | struct Books Book1; /* Declare Book1 of type Book */ 17 | struct Books Book2; /* Declare Book2 of type Book */ 18 | 19 | /* book 1 specification */ 20 | strcpy( Book1.title, "Dont Stare At Me"); 21 | strcpy( Book1.author, "Rajesh Kafle"); 22 | strcpy( Book1.subject, "Fundamentals of Brain Programming"); 23 | Book1.book_id = 6495407; 24 | 25 | /* book 2 specification */ 26 | strcpy( Book2.title, "Single Single KungFu"); 27 | strcpy( Book2.author, "Prakash KC"); 28 | strcpy( Book2.subject, "Fundamentals of Dont Angry Me"); 29 | Book2.book_id = 6495700; 30 | 31 | /* print Book1 info */ 32 | printBook( Book1 ); 33 | 34 | /* Print Book2 info */ 35 | printBook( Book2 ); 36 | 37 | return 0; 38 | } 39 | 40 | void printBook( struct Books book ) { 41 | 42 | printf( "Book title : %s\n", book.title); 43 | printf( "Book author : %s\n", book.author); 44 | printf( "Book subject : %s\n", book.subject); 45 | printf( "Book book_id : %d\n", book.book_id); 46 | printf("\n\n"); 47 | } -------------------------------------------------------------------------------- /codes/structure/union.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | union student{ 5 | int roll; 6 | float marks; 7 | }; 8 | union student st; 9 | st.roll=455; 10 | printf("Roll=%d\n", st.roll); 11 | 12 | st.marks=67; 13 | printf("marks=%d\n", st.marks); 14 | 15 | } -------------------------------------------------------------------------------- /forfuture: -------------------------------------------------------------------------------- 1 | Follow this chart for your future 2 | 3 | https://github.com/kamranahmedse/developer-roadmap 4 | -------------------------------------------------------------------------------- /learngit/README.md: -------------------------------------------------------------------------------- 1 | ####Follow the link To see how git works 2 | 3 | ``` 4 | http://learngitbranching.js.org/ 5 | ``` 6 | -------------------------------------------------------------------------------- /lectures/Unit 1. Problem Solving with Computer/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/chapter1copy-160229094610/95/unit-1-problem-solving-with-computer-1-638.jpg?cb=1456739548)](http://www.ashimlamichhane.com.np/2016/08/unit-1-problem-solving-with-computer/) 2 | -------------------------------------------------------------------------------- /lectures/Unit 10. Files and file handling in C/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/filesandfilehandlinginc-160330191730/95/unit-10-files-and-file-handling-in-c-1-638.jpg?cb=1459365805)](http://www.ashimlamichhane.com.np/2016/08/unit-10-files-and-file-handling-in-c/) -------------------------------------------------------------------------------- /lectures/Unit 11. Introduction to Graphics/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/graphics-160331210312/95/unit-11-graphics-1-638.jpg?cb=1459458298)](http://www.ashimlamichhane.com.np/2016/08/unit-11-introduction-to-graphics/) -------------------------------------------------------------------------------- /lectures/Unit 2. Elements of C/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/elementsofc-160229095039/95/unit-2-elements-of-c-1-638.jpg?cb=1456739492)](http://www.ashimlamichhane.com.np/2016/08/unit-2-elements-of-c/) 2 | -------------------------------------------------------------------------------- /lectures/Unit 3. Input and Output/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/inputoutput-160229095310/95/unit-3-input-and-output-1-638.jpg?cb=1456739648)](http://www.ashimlamichhane.com.np/2016/08/unit-3-input-and-output/) -------------------------------------------------------------------------------- /lectures/Unit 4. Operators and Expression/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/operators-160229095423/95/unit-4-operators-and-expression-1-638.jpg?cb=1456739703)](http://www.ashimlamichhane.com.np/2016/08/unit-4-operators-and-expression/) -------------------------------------------------------------------------------- /lectures/Unit 5. Control Statement/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/unit5-160229095534/95/unit-5-control-statement-1-638.jpg?cb=1456739793)](http://www.ashimlamichhane.com.np/2016/08/unit-5-control-statement/) -------------------------------------------------------------------------------- /lectures/Unit 6. Arrays/README.md: -------------------------------------------------------------------------------- 1 | UNIT 6 2 | ======================================================== 3 | 4 | [![Image of Slide](http://image.slidesharecdn.com/unit6arrays-160229095654/95/unit-6-arrays-1-638.jpg?cb=1456764378)](http://www.ashimlamichhane.com.np/2016/08/unit-6-arrays/) 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lectures/Unit 6. Arrays/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashim888/csit-c/777ce2b31e0f01a32ba6be2c83c94ab807d0baf5/lectures/Unit 6. Arrays/image.png -------------------------------------------------------------------------------- /lectures/Unit 7. Functions/README.md: -------------------------------------------------------------------------------- 1 | ASSIGNMENT 2 | ======================================================== 3 | 4 | [![Image of Slide](http://image.slidesharecdn.com/functions-160229095817/95/unit-7-functions-1-638.jpg?cb=1456764314)](http://www.ashimlamichhane.com.np/2016/08/unit-7-functions/) 5 | 6 | EXAMPLE 7 | ======================================================== 8 | ###C Program to Display Prime Numbers Between Intervals Using User-defined Function### 9 | ``` 10 | #include 11 | int check_prime(int num); 12 | int main(){ 13 | int n1,n2,i,flag; 14 | printf("Enter two numbers(intervals): "); 15 | scanf("%d %d",&n1, &n2); 16 | printf("Prime numbers between %d and %d are: ", n1, n2); 17 | for(i=n1+1;i 42 | int prime(int n); 43 | int armstrong(int n); 44 | int main() 45 | { 46 | char c; 47 | int n,temp=0; 48 | printf("Eneter a positive integer: "); 49 | scanf("%d",&n); 50 | printf("Enter P to check prime and A to check Armstrong number: "); 51 | c=getche(); 52 | if (c=='p' || c=='P') 53 | { 54 | temp=prime(n); 55 | if(temp==1) 56 | printf("\n%d is a prime number.", n); 57 | else 58 | printf("\n%d is not a prime number.", n); 59 | } 60 | if (c=='a' || c=='A') 61 | { 62 | temp=armstrong(n); 63 | if(temp==1) 64 | printf("\n%d is an Armstrong number.", n); 65 | else 66 | printf("\n%d is not an Armstrong number.",n); 67 | } 68 | return 0; 69 | } 70 | int prime(int n) 71 | { 72 | int i, flag=1; 73 | for(i=2; i<=n/2; ++i) 74 | { 75 | if(n%i==0) 76 | { 77 | flag=0; 78 | break; 79 | } 80 | } 81 | return flag; 82 | } 83 | int armstrong(int n) 84 | { 85 | int num=0, temp, flag=0; 86 | temp=n; 87 | while(n!=0) 88 | { 89 | num+=(n%10)*(n%10)*(n%10); 90 | n/=10; 91 | } 92 | if (num==temp) 93 | flag=1; 94 | return flag; 95 | } 96 | ``` -------------------------------------------------------------------------------- /lectures/Unit 8. Pointers/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/pointer-160323210326/95/pointers-1-638.jpg?cb=1458767097)](http://www.ashimlamichhane.com.np/2016/08/unit-8-pointers/) 2 | -------------------------------------------------------------------------------- /lectures/Unit 9. Structure and Union/README.md: -------------------------------------------------------------------------------- 1 | [![Image of Slide](http://image.slidesharecdn.com/structureandunions-160328042531/95/structure-and-unions-1-638.jpg?cb=1459139268)](http://www.ashimlamichhane.com.np/2016/08/unit-9-structure-and-union/) 2 | 3 | Structure Assignment 4 | ======================================================== 5 | 1. Define a structure of employee having data members name, address, age and salary. Take data for n employee in an array dynamically and find the average salary. 6 | 7 | 2. Why structure is required? Make a program using structure of booklist having data members title, author and cost. Enter four data and calculate total cost. 8 | 9 | 3. Define a structure of student having data members name, address, marks in C languages and marks in information system. Take data for n students in an array dynamically and find the total marks obtained. 10 | 11 | 4. Explain the array of structures and write a program to accept record of 15 person which has name, age and address and also display them. 12 | 13 | 5. Write a program to read name and district of N students from keyboard using structure variable and display only those students whose address is 'Kathmandu' district. (Hint: strcmp()) 14 | 15 | 6. Represent 3-D co-ordinates using a structure. Write a C program using a function takes two co-ordinates and returns a third co-ordinate as their mid point. 16 | 17 | 7. Write a program that reads name, phone, email and mailing address of 20 persons and rearrange the names into alphabetical order, and then display all information in the alphabetized list. 18 | 19 | 8. Create a structure named distance from user which as members: meter and centimeter. Write a program to read a distance from user and multiply the entered distance by 5 and then display the resultant distance. 20 | 21 | 9. For what kinds of applications are unions useful? Explain with an example. -------------------------------------------------------------------------------- /project_work/2017batch/README.md: -------------------------------------------------------------------------------- 1 | ###Morning 2 | 3 | ###Student Attendance System 4 | -------------------------------------------------------- 5 | Ajit Poudel 6 | 7 | Jyotindra Subedi 8 | 9 | Prasuna Mudawari 10 | 11 | Sunil Thapa 12 | 13 | ###Hospital Patient Record System 14 | -------------------------------------------------------- 15 | Sujit Manandhar 16 | 17 | Gupta Bahadur Chhetri 18 | 19 | Bibek Khatiwada 20 | 21 | Samrat Kafle 22 | 23 | ###Tic tac Toe 24 | -------------------------------------------------------- 25 | Kshitiz Regmi 26 | 27 | Binita K.C. 28 | 29 | Birendra Kumar Thapaliya 30 | 31 | Poojan Bade 32 | 33 | ###Movie Hall ticketing System 34 | -------------------------------------------------------- 35 | Pabitra Pantha 36 | 37 | Rochak Pandey 38 | 39 | Sudip Karki 40 | 41 | Allen Nembang 42 | 43 | 44 | ###4 Pic one word resolver 45 | -------------------------------------------------------- 46 | Saroj Poudel 47 | 48 | Rabin Shrestha 49 | 50 | Janam Khatiwada 51 | 52 | Mahesh Aryal 53 | 54 | ###Hotel Booking Management System 55 | -------------------------------------------------------- 56 | Raju Bhattarai 57 | 58 | Srijan Singh Rimal 59 | 60 | Rupesh Pandit 61 | 62 | Junu Chaulagain 63 | 64 | ###DAY 65 | 66 | ###Tic Tac Toe 67 | -------------------------------------------------------- 68 | Bishal Marasaini 69 | 70 | Asmita Karki 71 | 72 | Rojen Shrestha 73 | 74 | Surendra Shrestha 75 | 76 | 77 | ###4 pic one word resolver 78 | -------------------------------------------------------- 79 | Prasidha Acharya 80 | 81 | Anil Banskota 82 | 83 | Manish Kumar yadav 84 | 85 | Nabin Silwal 86 | 87 | 88 | ###Bank Loan Management System 89 | -------------------------------------------------------- 90 | Rabin Neupane 91 | 92 | Parash Gurung 93 | 94 | Mukesh Mahara 95 | 96 | Biswas Dhakal 97 | 98 | 99 | ###Student Database Management System 100 | -------------------------------------------------------- 101 | Kiran Gajurel 102 | 103 | Sushil Sundar Bajracharya 104 | 105 | Aeliya Tamang 106 | 107 | Suman Rijal 108 | 109 | 110 | ###Library Management System 111 | -------------------------------------------------------- 112 | Sujan Basnet 113 | 114 | Mina Prajapati 115 | 116 | Sandhya Ghimire 117 | 118 | Sajan Dhakal 119 | 120 | 121 | ###Student Attendance System 122 | -------------------------------------------------------- 123 | Jyoti Bista 124 | 125 | Sandip Chaudhary 126 | 127 | Padam Raj Rijal 128 | 129 | Dipak Prasad Sharma -------------------------------------------------------------------------------- /project_work/README.md: -------------------------------------------------------------------------------- 1 | ## Project Schedule ## 2 | 3 | ``` 4 | * Initial Presentation - 23rd February 5 | 6 | * Final Presentation - 28th May 7 | + Please do wear formal dress 8 | + MALE (Shirt,Pant etc) 9 | + FEMALE (Kurta,Saree etc) 10 | + Please do bring printed copy of your Project 11 | + For further query do email me at punchedrock@gmail.com 12 | 13 | ``` 14 | 15 | ## Project Report Guideline ## 16 | 17 | ``` 18 | * Title Page 19 | 20 | * Acknowledgement 21 | 22 | * Table of Content 23 | 24 | * Introduction of the Project 25 | 26 | * System Study 27 | + Existing System 28 | + Problem Identification / Problem Statement 29 | + Methodologies 30 | 31 | * Requirement Analysis and Feasibility Study 32 | + Objective (written in bullet; can be up to 3 to 5 starts with “To..”) 33 | + Requrirement Specification 34 | + Data Flow Diagram 35 | + Data Dictionary 36 | + Scope of Project 37 | + Feasibility Analysis 38 | + Technical Feasibility 39 | + Economic Feasibility 40 | + Operational Feasibility 41 | 42 | * System Design 43 | + Flow chart 44 | + Database (if any) 45 | + Back and Front End 46 | 47 | * Implementation 48 | 49 | * Maintenance and Support 50 | 51 | * Conclusion and Enhancements 52 | ``` 53 | 54 | ###Project Title #### 55 | ----------------------------- 56 | ``` 57 | 1. Library Management System 58 | 2. Marks Sheet Management System 59 | 3. Department Store bill Management System 60 | 4. Stock Management System 61 | 5. Accounting Management System 62 | 6. Student Attendance System 63 | 7. Student database Management System 64 | 8. Hotel Booking Management System 65 | 9. Movie Hall ticketing System 66 | 10. Insurance policy Management System 67 | 11. Bank Loan Management System 68 | 12. Hospital Patient Record System 69 | 13. Tic Tac Toe 70 | 14. 4 pic one word resolver 71 | ``` -------------------------------------------------------------------------------- /students_email_2017.md: -------------------------------------------------------------------------------- 1 | ###MORNING 2 | ------ 3 | Ajit Poudel aajeet.pod@gmail.com 4 | 5 | Allen Nembang nembangallen@gmail.com 6 | 7 | Bibek Khatiwada bibekkhatiwada16@gmail.com 8 | 9 | Binita K.C. muskan_bini@yahoo.com 10 | 11 | Birendra Kumar Thapaliya sarwanthapaliya@gmail.com 12 | 13 | Gupta Bahadur Chhetri bdrchhetri75@gmail.com 14 | 15 | Janam Khatiwada jhapali.janam@gmail.com 16 | 17 | Junu Chaulagain junuchaulagain4@yahoo.com 18 | 19 | Jyotindra Subedi subediJyotindra@gmail.com 20 | 21 | Kshitiz Regmi kshitizregmi61@gmail.com 22 | 23 | Mahesh Aryal mahesharyal775@gmail.com 24 | 25 | Pabitra Pantha pabitra.pantha1@gmail.com 26 | 27 | Poojan Bade poojan_bade@yahoo.com 28 | 29 | Prasuna Mudawari smartkela@gmail.com 30 | 31 | Rabin Shrestha rabin647183@gmail.com 32 | 33 | Raju Bhattarai razubhattarai87@gmail.com 34 | 35 | Rochak Pandey 36 | 37 | Rupesh Pandit rupaceaveiro@gmail.com 38 | 39 | Samrat Kafle samratkafle12@gmail.com 40 | 41 | Saroj Poudel sarozzx@gmail.com 42 | 43 | Srijan Singh Rimal rmlsreetju@gmail.com 44 | 45 | Sudip Karki sudeepkarki123@gmail.com 46 | 47 | Sujit Manandhar sujit.manandhar07@gmail.com 48 | 49 | Sunil Thapa velainmbm300@gmail.com 50 | 51 | 52 | ###DAY 53 | ----- 54 | Aeliya Tamang aeliya.tmg1@gmail.com 55 | 56 | Anil Banskota anil.123aaaaaa@gmail.com 57 | 58 | Asmita Karki karkiasmita3@gmail.com 59 | 60 | Bishal Marasaini bishalchhetri961@gmail.com 61 | 62 | Biswas Dhakal biswasdhakal380@gmail.com 63 | 64 | Dipak Prasad Sharma 65 | 66 | Jyoti Bista zyotieebista12@gmail.com 67 | 68 | Kiran Gajurel kgajurel4@gmail.com 69 | 70 | Manish Kumar yadav manishyadav2354@gmail.com 71 | 72 | Mina Prajapati minaprajapati22@gmail.com 73 | 74 | Mukesh Mahara mukeshmahara1@gmail.com 75 | 76 | Nabin Silwal nabinsilwal0082@gmail.com 77 | 78 | Padam Raj Rijal padam.rijal@outlook.com 79 | 80 | Parash Gurung darkness_ruleroftheworld@yahoo.com 81 | 82 | Prasidha Acharya pracedha@gmail.com 83 | 84 | Rabin Neupane raveenneupane11@outlook.com 85 | 86 | Rojen Shrestha rojenshrestha100@gmail.com 87 | 88 | Sajan Dhakal Sajan12dhakal@gmail.com 89 | 90 | Sandhya Ghimire sandhyaghimire598@gmail.com 91 | 92 | Sandip Chaudhary sndp.c114@gmail.com 93 | 94 | Sujan Basnet sujanbasnyet334@gmail.com 95 | 96 | Suman Rijal 97 | 98 | Surendra Shrestha sthasurendra55@gmail.com 99 | 100 | Sushil Sundar Bajracharya bajra.suzhil@gmail.com 101 | --------------------------------------------------------------------------------