├── sampleC.txt ├── pr01_ch10.txt ├── pr03_2_ch10.txt ├── pr03_ch10.txt ├── README.md ├── sampleC2.txt ├── 46_Area.exe ├── 01_first.exe ├── 04_input.exe ├── 100_Files.exe ├── 109_Game.exe ├── 45_change.exe ├── 62_Arrays.exe ├── 79_strlen.exe ├── 80_strcpy.exe ├── 81_strcat.exe ├── 82_strcmp.exe ├── 02_variables.exe ├── 03_addition.exe ├── 05_pr01_ch1.exe ├── 06_pr02_ch1.exe ├── 07_pr03_ch1.exe ├── 08_pr04_ch1.exe ├── 101_reading.exe ├── 103_fwrite.exe ├── 111_calloc.exe ├── 113_freeDemo.exe ├── 114_realloc.exe ├── 12_pr01_ch2.exe ├── 13_pr03_ch2.exe ├── 15_else_if.exe ├── 16_else_if.exe ├── 19_pr02_ch3.exe ├── 20_pr03_ch3.exe ├── 21_pr04_ch3.exe ├── 22_pr06_ch3.exe ├── 24_loopIntro.exe ├── 25_Whileoop.exe ├── 27_DoWhile.exe ├── 29_ForLoop.exe ├── 33_continue.exe ├── 34_pr02_ch4.exe ├── 35_pr05_ch4.exe ├── 36_pr05_ch4.exe ├── 37_pr08_ch4.exe ├── 38_pr10_ch4.exe ├── 41_functions.exe ├── 47_recursion.exe ├── 48_pr01_ch5.exe ├── 49_pr03_ch5.exe ├── 50_pr04_ch5.exe ├── 51_pr05_ch5.exe ├── 52_pr07_ch5.exe ├── 53_pointers.exe ├── 56_pr01_ch6.exe ├── 57_pr02_ch6.exe ├── 58_pr03_ch6.exe ├── 59_pr04_ch6.exe ├── 60_pr05_ch6.exe ├── 61_pro6_ch6.exe ├── 68_2dArrays.exe ├── 69_pr01_ch7.exe ├── 70_pr03_ch7.exe ├── 71_pr05_ch7.exe ├── 72_pr07_ch7.exe ├── 73_pr09_ch7.exe ├── 74_strings.exe ├── 78_GetsPuts.exe ├── 83_pr02_ch8.exe ├── 84_pr03_ch8.exe ├── 85_pr04_ch8.exe ├── 86_pr06_ch8.exe ├── 87_pr07_ch8.exe ├── 88_pr08_ch8.exe ├── 95_Typedef.exe ├── 96_pr01_ch9.exe ├── 97_pr02_ch9.exe ├── 98_pr05_ch9.exe ├── 99_pr09_ch9.exe ├── 106_pr01_ch10.exe ├── 107_pr02_ch10.exe ├── 108_pr03_ch10.exe ├── 112_callocQuiz.exe ├── 115_pr04_ch11.exe ├── 116_pr05_ch11.exe ├── 18_switchCase.exe ├── 26_incrementOp.exe ├── 28_DoWhileQuiz.exe ├── 44_SumFunction.exe ├── 54_CallByValue.exe ├── 63_ArrayInput.exe ├── 75_PrintString.exe ├── 89_Structures.exe ├── 90_structInput.exe ├── 09_instructions.exe ├── 104_fgetc_fputc.exe ├── 110_M_Allocation.exe ├── 11_opPrecedence.exe ├── 14_conditionals.exe ├── 31_reverseOrder.exe ├── 32_BreakStatement.exe ├── 35_pr05_ch4_while.exe ├── 39_guessTheNumber.exe ├── 40_GuessTheNumber.exe ├── 42_greetFunction.exe ├── 43_F1_Inside_F2.exe ├── 64_initialization.exe ├── 66_ArrayPointers.exe ├── 76_PrintString2.exe ├── 77_InputStrings.exe ├── 92_Initialization.exe ├── 105_file_read_fgetc.exe ├── 30_decrementingFor.exe ├── 55_CallByReference.exe ├── 67_FunctionalArrays.exe ├── 91_StructuralArray.exe ├── 102_File_Exist_check.exe ├── 10_Airth_Instruction.exe ├── 17_Linear_conditional.exe ├── 65_PointerOperations.exe ├── 93_structuralPointers.exe ├── 94_PassingStructures.exe ├── 03_addition.c ├── 51_pr05_ch5.c ├── pr02_ch10.txt ├── 58_pr03_ch6.c ├── 77_InputStrings.c ├── 74_strings.c ├── 13_pr03_ch2.c ├── 29_ForLoop.c ├── 30_decrementingFor.c ├── 08_pr04_ch1.c ├── 07_pr03_ch1.c ├── 100_Files.c ├── 34_pr02_ch4.c ├── 79_strlen.c ├── 80_strcpy.c ├── 17_Linear_conditional.c ├── 36_pr05_ch4.c ├── 56_pr01_ch6.c ├── 75_PrintString.c ├── 46_Area.c ├── 60_pr05_ch6.c ├── 35_pr05_ch4_while.c ├── 39_randomNumber.c ├── 27_DoWhile.c ├── 24_loopIntro.c ├── 32_BreakStatement.c ├── 106_pr01_ch10.c ├── 37_pr08_ch4.c ├── 81_strcat.c ├── 12_pr01_ch2.c ├── 76_PrintString2.c ├── 105_file_read_fgetc.c ├── 25_Whileoop.c ├── 61_pro6_ch6.c ├── 45_change.c ├── 04_input.c ├── 11_opPrecedence.c ├── 31_reverseOrder.c ├── 33_continue.c ├── 70_pr03_ch7.c ├── 28_DoWhileQuiz.c ├── 78_GetsPuts.c ├── 103_fwrite.c ├── 06_pr02_ch1.c ├── 47_recursion.c ├── 86_pr06_ch8.c ├── 87_pr07_ch8.c ├── 101_reading.c ├── 21_pr04_ch3.c ├── 82_strcmp.c ├── 85_pr04_ch8.c ├── 14_conditionals.c ├── 41_functions.c ├── 84_pr03_ch8.c ├── 93_structuralPointers.c ├── 96_pr01_ch9.c ├── 44_SumFunction.c ├── 63_ArrayInput.c ├── 23_pr05_ch3.c ├── 59_pr04_ch6.c ├── 69_pr01_ch7.c ├── 49_pr03_ch5.c ├── 73_pr09_ch7.c ├── 52_pr07_ch5.c ├── 57_pr02_ch6.c ├── 01_first.c ├── 108_pr03_ch10.c ├── 88_pr08_ch8.c ├── 107_pr02_ch10.c ├── 92_Initialization.c ├── 111_calloc.c ├── 09_instructions.c ├── 38_pr10_ch4.c ├── 54_CallByValue.c ├── 62_Arrays.c ├── 26_incrementOp.c ├── 64_initialization.c ├── 67_FunctionalArrays.c ├── 02_variables.c ├── 71_pr05_ch7.c ├── 42_greetFunction.c ├── 48_pr01_ch5.c ├── 66_ArrayPointers.c ├── 89_Structures.c ├── 113_freeDemo.c ├── 05_pr01_ch1.c ├── 102_File_Exist_check.c ├── 116_pr05_ch11.c ├── 112_callocQuiz.c ├── 43_F1_Inside_F2.c ├── 50_pr04_ch5.c ├── 68_2dArrays.c ├── 53_pointers.c ├── 91_StructuralArray.c ├── 15_else_if.c ├── 110_M_Allocation.c ├── 55_CallByReference.c ├── 83_pr02_ch8.c ├── 19_pr02_ch3.c ├── 97_pr02_ch9.c ├── 98_pr05_ch9.c ├── 18_switchCase.c ├── 94_PassingStructures.c ├── 20_pr03_ch3.c ├── 115_pr04_ch11.c ├── 114_realloc.c ├── 16_else_if.c ├── 95_Typedef.c ├── 72_pr07_ch7.c ├── 40_GuessTheNumber.c ├── 90_structInput.c ├── 104_fgetc_fputc.c ├── 99_pr09_ch9.c ├── LICENSE ├── 65_PointerOperations.c ├── 10_Airth_Instruction.c ├── 109_Game.c └── 22_pr06_ch3.c /sampleC.txt: -------------------------------------------------------------------------------- 1 | 2 | cc -------------------------------------------------------------------------------- /pr01_ch10.txt: -------------------------------------------------------------------------------- 1 | 456 5603 9854 -------------------------------------------------------------------------------- /pr03_2_ch10.txt: -------------------------------------------------------------------------------- 1 | for problem number 3. -------------------------------------------------------------------------------- /pr03_ch10.txt: -------------------------------------------------------------------------------- 1 | for problem number 3. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # C-Language-Programs 2 | This Repo contains CWH C language Programs 3 | -------------------------------------------------------------------------------- /sampleC2.txt: -------------------------------------------------------------------------------- 1 | the value of number is 45 2 | we used fprint to write the above line. -------------------------------------------------------------------------------- /46_Area.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/46_Area.exe -------------------------------------------------------------------------------- /01_first.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/01_first.exe -------------------------------------------------------------------------------- /04_input.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/04_input.exe -------------------------------------------------------------------------------- /100_Files.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/100_Files.exe -------------------------------------------------------------------------------- /109_Game.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/109_Game.exe -------------------------------------------------------------------------------- /45_change.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/45_change.exe -------------------------------------------------------------------------------- /62_Arrays.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/62_Arrays.exe -------------------------------------------------------------------------------- /79_strlen.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/79_strlen.exe -------------------------------------------------------------------------------- /80_strcpy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/80_strcpy.exe -------------------------------------------------------------------------------- /81_strcat.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/81_strcat.exe -------------------------------------------------------------------------------- /82_strcmp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/82_strcmp.exe -------------------------------------------------------------------------------- /02_variables.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/02_variables.exe -------------------------------------------------------------------------------- /03_addition.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/03_addition.exe -------------------------------------------------------------------------------- /05_pr01_ch1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/05_pr01_ch1.exe -------------------------------------------------------------------------------- /06_pr02_ch1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/06_pr02_ch1.exe -------------------------------------------------------------------------------- /07_pr03_ch1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/07_pr03_ch1.exe -------------------------------------------------------------------------------- /08_pr04_ch1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/08_pr04_ch1.exe -------------------------------------------------------------------------------- /101_reading.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/101_reading.exe -------------------------------------------------------------------------------- /103_fwrite.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/103_fwrite.exe -------------------------------------------------------------------------------- /111_calloc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/111_calloc.exe -------------------------------------------------------------------------------- /113_freeDemo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/113_freeDemo.exe -------------------------------------------------------------------------------- /114_realloc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/114_realloc.exe -------------------------------------------------------------------------------- /12_pr01_ch2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/12_pr01_ch2.exe -------------------------------------------------------------------------------- /13_pr03_ch2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/13_pr03_ch2.exe -------------------------------------------------------------------------------- /15_else_if.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/15_else_if.exe -------------------------------------------------------------------------------- /16_else_if.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/16_else_if.exe -------------------------------------------------------------------------------- /19_pr02_ch3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/19_pr02_ch3.exe -------------------------------------------------------------------------------- /20_pr03_ch3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/20_pr03_ch3.exe -------------------------------------------------------------------------------- /21_pr04_ch3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/21_pr04_ch3.exe -------------------------------------------------------------------------------- /22_pr06_ch3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/22_pr06_ch3.exe -------------------------------------------------------------------------------- /24_loopIntro.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/24_loopIntro.exe -------------------------------------------------------------------------------- /25_Whileoop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/25_Whileoop.exe -------------------------------------------------------------------------------- /27_DoWhile.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/27_DoWhile.exe -------------------------------------------------------------------------------- /29_ForLoop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/29_ForLoop.exe -------------------------------------------------------------------------------- /33_continue.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/33_continue.exe -------------------------------------------------------------------------------- /34_pr02_ch4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/34_pr02_ch4.exe -------------------------------------------------------------------------------- /35_pr05_ch4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/35_pr05_ch4.exe -------------------------------------------------------------------------------- /36_pr05_ch4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/36_pr05_ch4.exe -------------------------------------------------------------------------------- /37_pr08_ch4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/37_pr08_ch4.exe -------------------------------------------------------------------------------- /38_pr10_ch4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/38_pr10_ch4.exe -------------------------------------------------------------------------------- /41_functions.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/41_functions.exe -------------------------------------------------------------------------------- /47_recursion.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/47_recursion.exe -------------------------------------------------------------------------------- /48_pr01_ch5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/48_pr01_ch5.exe -------------------------------------------------------------------------------- /49_pr03_ch5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/49_pr03_ch5.exe -------------------------------------------------------------------------------- /50_pr04_ch5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/50_pr04_ch5.exe -------------------------------------------------------------------------------- /51_pr05_ch5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/51_pr05_ch5.exe -------------------------------------------------------------------------------- /52_pr07_ch5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/52_pr07_ch5.exe -------------------------------------------------------------------------------- /53_pointers.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/53_pointers.exe -------------------------------------------------------------------------------- /56_pr01_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/56_pr01_ch6.exe -------------------------------------------------------------------------------- /57_pr02_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/57_pr02_ch6.exe -------------------------------------------------------------------------------- /58_pr03_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/58_pr03_ch6.exe -------------------------------------------------------------------------------- /59_pr04_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/59_pr04_ch6.exe -------------------------------------------------------------------------------- /60_pr05_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/60_pr05_ch6.exe -------------------------------------------------------------------------------- /61_pro6_ch6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/61_pro6_ch6.exe -------------------------------------------------------------------------------- /68_2dArrays.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/68_2dArrays.exe -------------------------------------------------------------------------------- /69_pr01_ch7.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/69_pr01_ch7.exe -------------------------------------------------------------------------------- /70_pr03_ch7.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/70_pr03_ch7.exe -------------------------------------------------------------------------------- /71_pr05_ch7.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/71_pr05_ch7.exe -------------------------------------------------------------------------------- /72_pr07_ch7.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/72_pr07_ch7.exe -------------------------------------------------------------------------------- /73_pr09_ch7.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/73_pr09_ch7.exe -------------------------------------------------------------------------------- /74_strings.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/74_strings.exe -------------------------------------------------------------------------------- /78_GetsPuts.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/78_GetsPuts.exe -------------------------------------------------------------------------------- /83_pr02_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/83_pr02_ch8.exe -------------------------------------------------------------------------------- /84_pr03_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/84_pr03_ch8.exe -------------------------------------------------------------------------------- /85_pr04_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/85_pr04_ch8.exe -------------------------------------------------------------------------------- /86_pr06_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/86_pr06_ch8.exe -------------------------------------------------------------------------------- /87_pr07_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/87_pr07_ch8.exe -------------------------------------------------------------------------------- /88_pr08_ch8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/88_pr08_ch8.exe -------------------------------------------------------------------------------- /95_Typedef.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/95_Typedef.exe -------------------------------------------------------------------------------- /96_pr01_ch9.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/96_pr01_ch9.exe -------------------------------------------------------------------------------- /97_pr02_ch9.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/97_pr02_ch9.exe -------------------------------------------------------------------------------- /98_pr05_ch9.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/98_pr05_ch9.exe -------------------------------------------------------------------------------- /99_pr09_ch9.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/99_pr09_ch9.exe -------------------------------------------------------------------------------- /106_pr01_ch10.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/106_pr01_ch10.exe -------------------------------------------------------------------------------- /107_pr02_ch10.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/107_pr02_ch10.exe -------------------------------------------------------------------------------- /108_pr03_ch10.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/108_pr03_ch10.exe -------------------------------------------------------------------------------- /112_callocQuiz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/112_callocQuiz.exe -------------------------------------------------------------------------------- /115_pr04_ch11.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/115_pr04_ch11.exe -------------------------------------------------------------------------------- /116_pr05_ch11.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/116_pr05_ch11.exe -------------------------------------------------------------------------------- /18_switchCase.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/18_switchCase.exe -------------------------------------------------------------------------------- /26_incrementOp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/26_incrementOp.exe -------------------------------------------------------------------------------- /28_DoWhileQuiz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/28_DoWhileQuiz.exe -------------------------------------------------------------------------------- /44_SumFunction.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/44_SumFunction.exe -------------------------------------------------------------------------------- /54_CallByValue.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/54_CallByValue.exe -------------------------------------------------------------------------------- /63_ArrayInput.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/63_ArrayInput.exe -------------------------------------------------------------------------------- /75_PrintString.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/75_PrintString.exe -------------------------------------------------------------------------------- /89_Structures.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/89_Structures.exe -------------------------------------------------------------------------------- /90_structInput.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/90_structInput.exe -------------------------------------------------------------------------------- /09_instructions.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/09_instructions.exe -------------------------------------------------------------------------------- /104_fgetc_fputc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/104_fgetc_fputc.exe -------------------------------------------------------------------------------- /110_M_Allocation.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/110_M_Allocation.exe -------------------------------------------------------------------------------- /11_opPrecedence.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/11_opPrecedence.exe -------------------------------------------------------------------------------- /14_conditionals.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/14_conditionals.exe -------------------------------------------------------------------------------- /31_reverseOrder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/31_reverseOrder.exe -------------------------------------------------------------------------------- /32_BreakStatement.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/32_BreakStatement.exe -------------------------------------------------------------------------------- /35_pr05_ch4_while.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/35_pr05_ch4_while.exe -------------------------------------------------------------------------------- /39_guessTheNumber.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/39_guessTheNumber.exe -------------------------------------------------------------------------------- /40_GuessTheNumber.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/40_GuessTheNumber.exe -------------------------------------------------------------------------------- /42_greetFunction.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/42_greetFunction.exe -------------------------------------------------------------------------------- /43_F1_Inside_F2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/43_F1_Inside_F2.exe -------------------------------------------------------------------------------- /64_initialization.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/64_initialization.exe -------------------------------------------------------------------------------- /66_ArrayPointers.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/66_ArrayPointers.exe -------------------------------------------------------------------------------- /76_PrintString2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/76_PrintString2.exe -------------------------------------------------------------------------------- /77_InputStrings.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/77_InputStrings.exe -------------------------------------------------------------------------------- /92_Initialization.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/92_Initialization.exe -------------------------------------------------------------------------------- /105_file_read_fgetc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/105_file_read_fgetc.exe -------------------------------------------------------------------------------- /30_decrementingFor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/30_decrementingFor.exe -------------------------------------------------------------------------------- /55_CallByReference.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/55_CallByReference.exe -------------------------------------------------------------------------------- /67_FunctionalArrays.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/67_FunctionalArrays.exe -------------------------------------------------------------------------------- /91_StructuralArray.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/91_StructuralArray.exe -------------------------------------------------------------------------------- /102_File_Exist_check.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/102_File_Exist_check.exe -------------------------------------------------------------------------------- /10_Airth_Instruction.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/10_Airth_Instruction.exe -------------------------------------------------------------------------------- /17_Linear_conditional.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/17_Linear_conditional.exe -------------------------------------------------------------------------------- /65_PointerOperations.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/65_PointerOperations.exe -------------------------------------------------------------------------------- /93_structuralPointers.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/93_structuralPointers.exe -------------------------------------------------------------------------------- /94_PassingStructures.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aniket-2003-das/C-Language-Programs/HEAD/94_PassingStructures.exe -------------------------------------------------------------------------------- /03_addition.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int x = 3; 6 | int y = 8; 7 | printf("the sum of x and y is %d \n", x + y); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /51_pr05_ch5.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a = 3; 5 | printf("%d %d %d", a, ++a, a++); // arguements are taken in order of right to left. 6 | return 0; 7 | } -------------------------------------------------------------------------------- /pr02_ch10.txt: -------------------------------------------------------------------------------- 1 | 21 X 1 = 21 2 | 21 X 2 = 42 3 | 21 X 3 = 63 4 | 21 X 4 = 84 5 | 21 X 5 = 105 6 | 21 X 6 = 126 7 | 21 X 7 = 147 8 | 21 X 8 = 168 9 | 21 X 9 = 189 10 | 21 X 10 = 210 11 | -------------------------------------------------------------------------------- /58_pr03_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | void changeValue(int* g){ 3 | printf("the new value is %d\n", 10*(*g)); 4 | } 5 | int main(){ 6 | int a = 9; 7 | changeValue(&a); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /77_InputStrings.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | char s[34]; 5 | printf("enter your name-:\n"); 6 | scanf("%s", s); 7 | printf("your name is %s", s); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /74_strings.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | char str[]={'H', 'e', 'l', 'l', 'o', '\0'}; // 1 charectar has storage of 1 byte. 5 | char str2[] = "Hello"; // easy way. 6 | return 0; 7 | } -------------------------------------------------------------------------------- /13_pr03_ch2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int num; 5 | printf("enter the number\n"); 6 | scanf("%d", &num); 7 | printf("Divisibility test returns : %d\n", num%97); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /29_ForLoop.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | for (int a = 1; a <= 10; a++) // (initialize; test; increment) 6 | { 7 | printf("%d\n", a); 8 | } 9 | 10 | return 0; 11 | } -------------------------------------------------------------------------------- /30_decrementingFor.c: -------------------------------------------------------------------------------- 1 | #include 2 | // decrementing for loop. 3 | int main(){ 4 | int i; 5 | for (i = 10; i; i--) 6 | { 7 | printf("%d\n", i); 8 | } 9 | return 0; 10 | } -------------------------------------------------------------------------------- /08_pr04_ch1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int principal=100, rate=12, time=4; 5 | int SI = (principal*rate*time)/100; 6 | printf("the value of simple Intrest is %d", SI); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /07_pr03_ch1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | float celcius = 37, farenheit; 5 | farenheit = (celcius * 9 / 5) + 32; 6 | printf("the value of farenheit tempreture is %f", farenheit); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /100_Files.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | // ptr = fopen("sampleC++.txt", "r");// --> for reading a file 6 | ptr = fopen("sampleC.txt", "w");// --> for writing a file 7 | return 0; 8 | } -------------------------------------------------------------------------------- /34_pr02_ch4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | // for (int i = 1; i; i++) 6 | for (int i = 10; i; i--) 7 | { 8 | printf("10 X %d = %d\n", i, 10 * i); 9 | } 10 | return 0; 11 | } -------------------------------------------------------------------------------- /79_strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | char *st = "Hello"; 6 | int a = strlen(st); // Excludes the null charectar. 7 | printf("The length is string st is %d", a); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /80_strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | char *st = "New string."; 6 | char st2[45]; 7 | strcpy(st2, st); 8 | printf("now the str2 string is %s", st2); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /17_Linear_conditional.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a; 5 | printf("enter a\n"); 6 | scanf("%d", &a); 7 | 8 | (a<5)? printf("a is less than 5") : printf("a is greater than 5"); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /36_pr05_ch4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i, sum, n = 10; 5 | for (i = 1; i <= n; i++) 6 | { 7 | sum+=i; 8 | } 9 | printf("the value of sum (1 to 10) is %d", sum); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /56_pr01_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a = 8; 6 | int *ptr = &a; 7 | printf("the address of variable a is %u\n", ptr); 8 | printf("the value of variable a is %d\n", *ptr); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /75_PrintString.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | char str[]= "hello world."; 5 | char *ptr=str; 6 | while(*ptr!='\0') 7 | { 8 | printf("%c", *ptr); 9 | ptr++; 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /46_Area.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int side; 6 | printf("enter the value of side-:\n"); 7 | scanf("%d", &side); 8 | printf("the value of area is %f\n", pow(side, 2)); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /60_pr05_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 345; 6 | int *ptr; 7 | int **ptr_ptr; 8 | ptr = &i; 9 | ptr_ptr = &ptr; 10 | 11 | printf("the value of i is %d\n", **ptr_ptr); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /35_pr05_ch4_while.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i=1, sum = 0, n = 10; 5 | 6 | while (i<=n){ 7 | sum +=i; 8 | i++; 9 | } 10 | printf("the value of sum (1 to 10) is %d", sum); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /39_randomNumber.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main() 5 | { 6 | int number; 7 | srand(time(0)); 8 | number = rand() % 100 + 1; 9 | printf("the number is %d", number); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /27_DoWhile.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i = 220; 5 | // do while loop runs atleast once. 6 | do 7 | { 8 | printf("the value of i is %d\n", i); 9 | i++; 10 | } while (i<=10); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /24_loopIntro.c: -------------------------------------------------------------------------------- 1 | #include 2 | // print for 4 values. 3 | int main(){ 4 | int a = 1; 5 | printf("%d\n", a); 6 | a++; 7 | printf("%d\n", a); 8 | a++; 9 | printf("%d\n", a); 10 | a++; 11 | printf("%d\n", a); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /32_BreakStatement.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i = 0; 5 | do 6 | { 7 | printf("the value if i is %d\n", i); 8 | if (i==4){ 9 | break; 10 | } 11 | i++; 12 | } while (i<10); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /106_pr01_ch10.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | int a, b, c; 6 | ptr = fopen("pr01_ch10.txt", "r"); 7 | fscanf(ptr, "%d %d %d", &a, &b, &c); 8 | printf("the values of a b and c are %d %d %d", a, b, c); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /37_pr08_ch4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 0, n = 9, factorial = 1; 6 | for (i = 1; i <= n; i++) 7 | { 8 | factorial *= i; 9 | } 10 | printf("the value of factorial of %d is %d", n, factorial); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /81_strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | char st1[45] = " Hello"; 5 | char *st2 = "New string."; 6 | strcat(st1, st2); // does not counts spaces directly pastes. 7 | printf("now the str1 string is %s", st1); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /12_pr01_ch2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a; int b=a; // we had to use int again 5 | int v=3^3; // bitwise operator valid in c 6 | char dob = '8'; 7 | printf("%d\n", dob); // double "" for printf and char prints memeory location 8 | return 0; 9 | } -------------------------------------------------------------------------------- /76_PrintString2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | char *ptr = "Paa Bhai"; 5 | char pointer[11]= "Suu Bhai"; 6 | ptr = "Paa Bhai is great."; // We cant change array named pointer. 7 | printf("%s\n", ptr); 8 | printf("%s", pointer); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /105_file_read_fgetc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | char c; 6 | ptr = fopen("sampleC2.txt", "r"); 7 | c = fgetc(ptr); 8 | while (c!=EOF) 9 | { 10 | printf("%c", c); 11 | c = fgetc(ptr); 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /25_Whileoop.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; // could be float also. 6 | printf("enter the value of a \n"); 7 | scanf("%d", &a); 8 | while (a <= 10) 9 | { 10 | printf("%d\n", a); 11 | a++; 12 | } 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /61_pro6_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | void changeValue(int g){ 3 | printf("the functional value of the copy variable is %d\n", 10*(g)); 4 | } 5 | int main(){ 6 | int a = 9; 7 | changeValue(a); 8 | printf("the orignal value of main variable is %d\n", a); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /45_change.c: -------------------------------------------------------------------------------- 1 | #include 2 | void change(int a); 3 | int main(){ 4 | int b = 333; 5 | printf("the value of b before change is %d\n", b); 6 | change(b); 7 | printf("the value of b after change is %d\n", b); 8 | return 0; 9 | } 10 | void change(int b){ 11 | b = 77; 12 | } -------------------------------------------------------------------------------- /04_input.c: -------------------------------------------------------------------------------- 1 | #include 2 | // in scanf we use "&". 3 | int main() 4 | { 5 | int a, b; 6 | printf("enter the value of a\n"); 7 | scanf("%d", &a); 8 | printf("enter the value of b\n"); 9 | scanf("%d", &b); 10 | printf("the sum of a and b is %d\n", a+b); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /11_opPrecedence.c: -------------------------------------------------------------------------------- 1 | #include 2 | // 1st * / % 3 | // 2nd + - 4 | // 3rd = 5 | // in absense of parenthesis tie is brocken by associativity from left to right. 6 | int main() 7 | { 8 | int x = 4; 9 | int y = 9; 10 | printf("the value of 3x-4y is: %d", 3*x-4*y); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /31_reverseOrder.c: -------------------------------------------------------------------------------- 1 | #include 2 | // print N natural numbers in reverse order 3 | int main(){ 4 | int n; 5 | printf("enter the value of n\n"); 6 | scanf("%d", &n); 7 | for (int i = n; i; i--) 8 | { 9 | printf("the value of i is %d\n", i); 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /33_continue.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int skip = 5, i = 0; 5 | while (i<10) 6 | { 7 | i++; 8 | if(i!=skip){ 9 | continue; 10 | } 11 | else{ 12 | printf("%d\n", i); 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /70_pr03_ch7.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int mul[10]; 5 | for (int i = 0; i < 10; i++) 6 | { 7 | mul[i] = 5*(i+1); 8 | 9 | } 10 | for (int i = 0; i < 10; i++) 11 | { 12 | printf("5X%d = %d\n", i+1, mul[i]); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /28_DoWhileQuiz.c: -------------------------------------------------------------------------------- 1 | // print first n natural numbers 2 | #include 3 | 4 | int main() 5 | { 6 | int n, i = 1; 7 | printf("enter the value of n\n"); 8 | scanf("%d", &n); 9 | do 10 | { 11 | printf("%d\n", i); 12 | i++; 13 | } while (i <= n); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /78_GetsPuts.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | char s[34]; 5 | printf("enter your name-:\n"); 6 | gets(s); //Inputs multi words string. Reads from standard input. 7 | printf("your name is %s\n", s); 8 | puts(s); //reads the string input from standard output. 9 | return 0; 10 | } -------------------------------------------------------------------------------- /103_fwrite.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *fptr; 5 | int number = 45; 6 | fptr = fopen("sampleC2.txt", "w"); 7 | fprintf(fptr, "the value of number is %d\n", number); 8 | fprintf(fptr, "we used fprint to write the above line."); 9 | fclose(fptr); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /06_pr02_ch1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int radius = 3; 6 | float pi = 3.14; 7 | printf("the area of circle is %f\n", pi * radius * radius); 8 | int height = 3; 9 | printf("the volume of cylinder with same radius is %f", pi * radius * radius * height); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /47_recursion.c: -------------------------------------------------------------------------------- 1 | #include 2 | int factorial(int x); 3 | int main(){ 4 | int a = factorial(3); 5 | printf("factorial %d is %d", a, factorial(a)); 6 | return 0; 7 | } 8 | int factorial(int x){ 9 | if (x==1 || x == 0){ 10 | return 1; 11 | } 12 | else{ 13 | return x* factorial(x-1); 14 | } 15 | } -------------------------------------------------------------------------------- /86_pr06_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | void encrypt(char *c){ 3 | char *ptr = c; 4 | while(*ptr!='\0'){ 5 | *ptr = *ptr + 1; 6 | ptr++; 7 | } 8 | } 9 | 10 | int main(){ 11 | char c[] = "Hello world this is c language"; 12 | encrypt(c); 13 | printf("Encrypted string is-: %s", c); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /87_pr07_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | void Decrypt(char *c){ 3 | char *ptr = c; 4 | while(*ptr!='\0'){ 5 | *ptr = *ptr - 1; 6 | ptr++; 7 | } 8 | } 9 | 10 | int main(){ 11 | char c[] = "Ifmmp!xpsme!uijt!jt!d!mbohvbhf"; 12 | Decrypt(c); 13 | printf("Decrypted string is-: %s", c); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /101_reading.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | int num, num2; 6 | ptr = fopen("sampleC.txt", "r"); 7 | fscanf(ptr, "%d", &num); 8 | fscanf(ptr, "%d", &num2); 9 | printf("the value of num is %d\n", num); 10 | printf("the value of num is %d\n", num2); 11 | fclose(ptr); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /21_pr04_ch3.c: -------------------------------------------------------------------------------- 1 | // leap year. 2 | #include 3 | 4 | int main() 5 | { 6 | int year; 7 | printf("enter the year\n"); 8 | scanf("%d", &year); 9 | if (year % 4 == 0) 10 | { 11 | printf("%d is a leap year", year); 12 | } 13 | else 14 | { 15 | printf("%d is not a leap year", year); 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /82_strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | char st1[45] = "Hello"; 5 | char *st2 = "Hallo"; 6 | int val = strcmp(st1, st2); // 0 for same ascii values in string. had produced -1 if ascii(str1)-ascii(str2) would give a negetive value. 7 | printf("now the val is %d", val); // +1 as ascii(e)-ascii(a) = (+)ve. 8 | return 0; 9 | } -------------------------------------------------------------------------------- /85_pr04_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void slice(char *st, int m, int n){ 4 | int i = 0; 5 | while((i+m) 2 | // even or odd? 3 | int main(){ 4 | int a,b; 5 | printf("enter a number\n"); 6 | scanf("%d", &a); 7 | if(a%2==0){ // no curly brackets required if only one statement. 8 | printf("%d is even \n", a); 9 | } 10 | else{ 11 | printf("%d is odd \n", a); 12 | 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /41_functions.c: -------------------------------------------------------------------------------- 1 | #include 2 | void display(); // Function prototype. 3 | 4 | int main(){ 5 | int a; 6 | printf("Initialising display function.\n"); 7 | display(); // Function call. 8 | printf("display function executed.\n"); 9 | return 0; 10 | } 11 | // Function definition 12 | void display(){ 13 | printf("display functin is active.\n"); 14 | } -------------------------------------------------------------------------------- /84_pr03_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | int strlen(char * st){ 3 | char *ptr = st; 4 | int len = 0; 5 | while(*ptr !='\0'){ 6 | len++; 7 | ptr++; 8 | } 9 | return len; 10 | } 11 | int main(){ 12 | char st[]= "Hello world"; 13 | int length = strlen(st); 14 | printf("the length of the string is %d", length); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /93_structuralPointers.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[18]; 8 | }; 9 | int main(){ 10 | struct employee e1; 11 | struct employee *ptr; 12 | 13 | ptr = &e1; 14 | // (*ptr).code = 101; 15 | ptr->code = 101; 16 | printf("%d\n", e1.code); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /96_pr01_ch9.c: -------------------------------------------------------------------------------- 1 | #include 2 | struct vector{ 3 | int x; 4 | int y; 5 | }; 6 | int main(){ 7 | struct vector v1, v2; 8 | v1.x = 34; 9 | v1.y = 54; 10 | printf("x dimension is %d and y dimension is %d\n", v1.x, v1.y); 11 | v2.x = 42; 12 | v2.y = 46; 13 | printf("x dimension is %d and y dimension is %d\n", v2.x, v2.y); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /44_SumFunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | int sum(int a, int b); 3 | // sum is a function which takes a nd b as input and returns integer as output. 4 | int main() 5 | { 6 | int c; 7 | c = sum(21, 53); 8 | printf("The value of c is %d\n", c); 9 | return 0; 10 | } 11 | 12 | int sum(int a, int b) 13 | { 14 | int result; 15 | result = a + b; 16 | return result; 17 | } -------------------------------------------------------------------------------- /63_ArrayInput.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int marks[5]; 5 | for(int i = 0; i < 5; i++) 6 | { 7 | printf("Enter the marks for student %d-:\n", i+1); 8 | scanf("%d", &marks[i+1]); 9 | } 10 | for(int i = 0; i < 5; i++) 11 | { 12 | printf("The marks for student %d is -: %d\n", i+1, marks[i]); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /23_pr05_ch3.c: -------------------------------------------------------------------------------- 1 | // lower case check detecter. ASCII-lower(97-122) 2 | #include 3 | 4 | int main(){ 5 | char ch; 6 | printf("enter the charectar\n"); 7 | scanf("%c", &ch); 8 | 9 | if (ch<=122 && ch>=97){ 10 | printf("the chatrectar %c is lowercase. "); 11 | } 12 | else{ 13 | printf("the chatrectar %c is lowercase. "); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /59_pr04_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | void pr04Function(int a, int b, int *Add1, float *Add2) 3 | { 4 | *Add1 = a + b; 5 | *Add2 = *Add1 / 2; 6 | } 7 | int main() 8 | { 9 | int i = 7, j = 9; 10 | int *sumAdd; 11 | float avg; 12 | pr04Function(i, j, sumAdd, &avg); 13 | printf("the sum is %d\n", *sumAdd); 14 | printf("the average is %f\n", avg); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /69_pr01_ch7.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int arr[10]; 5 | int * ptr = &arr[0]; 6 | // int * ptr = arr; // same as line 5. 7 | ptr = ptr + 2; 8 | if(ptr==&arr[2]){ 9 | printf("these point to the same location in memory\n"); 10 | } 11 | else{ 12 | printf("these dont point to the same location in memory\n"); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /49_pr03_ch5.c: -------------------------------------------------------------------------------- 1 | #include 2 | float Force(float mass); 3 | int main(){ 4 | float mass; 5 | printf("enter value of mass in kgs-:\n"); 6 | scanf("%f", &mass); 7 | printf("the value of force in newton is %0.3f N", Force(mass)); // 3 decimal points are calculated. 8 | return 0; 9 | } 10 | float Force(float mass){ 11 | float result = mass * 9.8; 12 | return result; 13 | } 14 | -------------------------------------------------------------------------------- /73_pr09_ch7.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int arr[2][3][4]; 5 | for (int i = 0; i < 2; i++) 6 | { 7 | for (int j = 0; j < 3; j++) 8 | { 9 | for (int k = 0; k < 4; k++) 10 | { 11 | printf("the address of arr[%d][%d][%d] is %u\n", i, j, k, &arr[i][j][k]); 12 | } 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /52_pr07_ch5.c: -------------------------------------------------------------------------------- 1 | #include 2 | void StarPattern(int n); 3 | int main(){ 4 | int n = 4; 5 | StarPattern(n); 6 | return 0; 7 | } 8 | void StarPattern(int n){ // in void function dont return 0. 9 | if (n==1){ 10 | printf("*\n"); 11 | return; 12 | } 13 | StarPattern(n-1); 14 | for(int i=0;i<(2*n-1);i++){ 15 | printf("*"); 16 | } 17 | printf("\n"); 18 | } -------------------------------------------------------------------------------- /57_pr02_ch6.c: -------------------------------------------------------------------------------- 1 | #include 2 | void printAddress(int a){ 3 | printf("the address of variable a is %u\n", &a); 4 | } 5 | int main(){ 6 | int i = 4; 7 | printf("the value of variable i is %d\n", *&i); 8 | printAddress(i); 9 | printf("the address of variable i is %u\n", &i); 10 | // the above address are not same as 1 is orignal and other is pass by value copy. 11 | return 0; 12 | } -------------------------------------------------------------------------------- /01_first.c: -------------------------------------------------------------------------------- 1 | # include// Libraries to instruct the compiler to include the standard input-output library, 2 | // which contains functions for input and output operations, such as printf() and scanf(). 3 | /* 4 | This is our first comment. gcc 01_first.c or gcc 01_first.c -o 01_first.exe 5 | */ 6 | int main(){ 7 | printf("hello world"); // priintf in c for %d & %f works for only "" and not ''. 8 | return 0; 9 | } -------------------------------------------------------------------------------- /108_pr03_ch10.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr1; 5 | FILE *ptr2; 6 | ptr1 = fopen("pr03_ch10.txt", "r"); 7 | ptr2 = fopen("pr03_2_ch10.txt", "w"); 8 | char c; 9 | c = fgetc(ptr1); 10 | while (c!=EOF){ 11 | fputc(c, ptr2); 12 | fputc(c, ptr2); 13 | c = fgetc(ptr1); 14 | } 15 | fclose(ptr1); 16 | fclose(ptr2); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /88_pr08_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | int occurence(char st[], char c){ 3 | char *ptr = st; 4 | int count = 0; 5 | while(*ptr!='\0'){ 6 | if (*ptr==c){ 7 | count++; 8 | } 9 | ptr++; 10 | } 11 | return count; 12 | } 13 | int main(){ 14 | char st[] = "Hello"; 15 | int count = occurence(st, 'l'); 16 | printf("occurence = %d", count); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /107_pr02_ch10.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | int num; 6 | printf("enter an integer to print its table\n"); 7 | scanf("%d", &num); 8 | ptr = fopen("pr02_ch10.txt", "w"); 9 | for (int i = 0; i<10; i++){ 10 | fprintf(ptr, "%d X %d = %d\n", num, i+1, num*(i+1)); 11 | } 12 | fclose(ptr); 13 | printf("table generated in pr02_ch10.txt."); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /92_Initialization.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[18]; 8 | }; 9 | int main(){ 10 | struct employee Aniket ={100, 34.23, "Aniket"}; 11 | 12 | printf("employee code is -: %d\n", Aniket.code); 13 | printf("employee salary is -: %.2f\n", Aniket.salary); 14 | printf("employee name is -: %s\n", Aniket.name); 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /111_calloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | 7 | ptr = (int *) calloc(6, sizeof(int)); 8 | for (int i = 0; i < 6; i++) 9 | { 10 | printf("Enter the value of %d element -:\n", i); 11 | scanf("%d", &ptr[i]); 12 | } 13 | for (int i = 0; i < 6; i++) 14 | { 15 | printf("the value of %d element is -: %d\n", i, ptr[i]); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /09_instructions.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a = 4; //type declaration instruction. 5 | int b = 4, c, d; //type declaration instruction. 6 | printf("the value of a is %d\n", d); // Here, the output is the numeric value of memory locant at time of execution. 7 | printf("the value of a is %d\n", a); 8 | float x = 1.1; 9 | float y = x + 8.9; 10 | printf("the value of y is %f\n", y); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /38_pr10_ch4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i, n = 7, prime = 1; 6 | for (i = 2; i < n; i++) 7 | { 8 | if (n % i == 0 && n != 2) 9 | { 10 | prime = 0; 11 | break; 12 | } 13 | } 14 | if (prime == 0) 15 | { 16 | printf("%d is not a prime number", n); 17 | } 18 | else 19 | { 20 | printf("this is a prime number"); 21 | } 22 | return 0; 23 | } -------------------------------------------------------------------------------- /54_CallByValue.c: -------------------------------------------------------------------------------- 1 | #include 2 | int sum (int a , int b ); 3 | int main(){ 4 | int a=4, b=7; 5 | printf("the value of a and b is %d and %d\n", a,b); 6 | printf("the value of 4+7 is %d\n", sum(a,b)); 7 | printf("the value of and b is %d and %d\n", a,b); 8 | return 0; 9 | } 10 | int sum (int a , int b ){ 11 | int c; 12 | c = a + b; 13 | b=3434; //Assigning values here dont changes result. 14 | a=23432; 15 | return c; 16 | } -------------------------------------------------------------------------------- /62_Arrays.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int marks[4]; 5 | printf("%d\n", marks); // will print the pointer address of first element of array. 6 | marks[0] = 95; 7 | marks[1] = 95; 8 | printf("Enter the marks for student 3-:\n"); 9 | scanf("%d", &marks[2]); 10 | printf("Enter the marks for student 3-:\n"); 11 | scanf("%d", &marks[3]); 12 | 13 | printf("you entered %d, %d", marks[2], marks[3]); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /26_incrementOp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 5; 6 | printf("the of i is %d\n", i); 7 | printf("the of i++ on false increment is %d\n", i++); // first print then increment. 8 | printf("the of i++ on visible increment(after a false increment also) is %d\n", ++i); // first increment then print. 9 | i+=10; // compound assignment operator. 10 | printf("the of i now after increment of 10 is %d\n", i); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /64_initialization.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | // int a[] = {34,32,23}; 5 | // printf("the value of a[0] is %d\n", a[0]); 6 | // printf("the value of a[1] is %d\n", a[1]); 7 | // printf("the value of a[2] is %d\n", a[2]); 8 | 9 | float a[] = {34,32,23}; 10 | printf("the value of a[0] is %f\n", a[0]); 11 | printf("the value of a[1] is %f\n", a[1]); 12 | printf("the value of a[2] is %f\n", a[2]); 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /67_FunctionalArrays.c: -------------------------------------------------------------------------------- 1 | #include 2 | void printArray(int ptr[], int n) // int*ptr 3 | { 4 | for(int i = 0; i 2 | 3 | int main() 4 | { 5 | int a = 3; 6 | // int b = 3.8; // not recomended as 3.8 is not an integer. 7 | float b = 3.8; 8 | char c = 'u'; 9 | int d = 7; 10 | int e = 3 + 7; 11 | printf("the value of a is %d \n", a); 12 | printf("the value of b is %f \n", b); 13 | printf("the value of c is %d \n", c); 14 | printf("the sum of a and d is %d \n", a + d); 15 | printf("the value of e is %d \n", e); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /71_pr05_ch7.c: -------------------------------------------------------------------------------- 1 | #include 2 | void reverse(int *arr, int n){ 3 | for (int i = 0; i < n/2; i++) 4 | { 5 | int temp; 6 | temp = arr[i]; 7 | arr[i] = arr[n-i-1]; 8 | arr[n-i-1] = temp; 9 | } 10 | 11 | } 12 | int main(){ 13 | int arr[]={1,2,3,4,5,6,7}; 14 | reverse(arr, 7); 15 | int n; 16 | for (int i = 0; i < 7; i++) 17 | { 18 | printf("the value of %d element is -: %d\n", i, arr[i]); 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /42_greetFunction.c: -------------------------------------------------------------------------------- 1 | #include 2 | void goodMorning(), goodAfternoon(), goodEvening(), goodNight(); 3 | int main() 4 | { 5 | goodMorning(), goodAfternoon(); 6 | goodEvening(), goodNight(); 7 | return 0; 8 | } 9 | void goodMorning() 10 | { 11 | printf("good morning\n"); 12 | } 13 | void goodAfternoon() 14 | { 15 | printf("good Afternoon\n"); 16 | } 17 | void goodEvening() 18 | { 19 | printf("good Evening\n"); 20 | } 21 | void goodNight() 22 | { 23 | printf("good Night\n"); 24 | } 25 | -------------------------------------------------------------------------------- /48_pr01_ch5.c: -------------------------------------------------------------------------------- 1 | #include 2 | float average (int a, int b, int c); 3 | int main(){ 4 | int a, b, c; 5 | printf("enter value of a-:\n"); 6 | scanf("%d", &a); 7 | printf("enter value of b-:\n"); 8 | scanf("%d", &b); 9 | printf("enter value of c-:\n"); 10 | scanf("%d", &c); 11 | printf("the average bvalue is %f",average(a, b, c)); 12 | return 0; 13 | } 14 | float average (int a, int b, int c){ 15 | float result; 16 | result = (float)(a + b + c)/3; 17 | return result; 18 | } -------------------------------------------------------------------------------- /66_ArrayPointers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int marks[4]; 5 | int* ptr; 6 | // ptr = &marks[0]; 7 | ptr = marks; // simply mentioning marks would assign pointer to the 1st element of array. 8 | for(int i = 0; i<4; i++){ 9 | printf("enter the marks of student %d-:\n", i+1); 10 | scanf("%d", ptr); 11 | ptr++; 12 | } 13 | for(int i = 0; i<4; i++){ 14 | printf("The marks of student %d is-: %d\n", i+1, marks[i]); 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /89_Structures.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[10]; 8 | }; 9 | 10 | int main(){ 11 | int a = 34; 12 | char b = 'g'; 13 | float d = 32.76; 14 | struct employee e1; 15 | e1.code = 100; 16 | e1.salary = 34.56; 17 | // e1.name = "Aniket"; // wont work 18 | strcpy(e1.name, "Aniket"); 19 | printf("%s\n", e1.name); 20 | printf("%.3f\n", e1.salary); 21 | printf("%d\n", e1.code); 22 | return 0; 23 | } -------------------------------------------------------------------------------- /113_freeDemo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr, *ptr2; 6 | ptr = (int *) malloc(6 * sizeof(int)); 7 | for (int i = 0; i < 600000; i++) 8 | { 9 | ptr2 = (int *) malloc(6 * sizeof(int)); 10 | printf("Enter the value of %d element -:\n", i); 11 | scanf("%d", &ptr[i]); 12 | free(ptr2); 13 | } 14 | for (int i = 0; i < 600000; i++) 15 | { 16 | printf("the value of %d element is -: %d\n", i, ptr[i]); 17 | } 18 | return 0; 19 | } -------------------------------------------------------------------------------- /05_pr01_ch1.c: -------------------------------------------------------------------------------- 1 | /* #include 2 | 3 | int main(){ 4 | int length = 3, breath = 4; 5 | int area = length*breath; 6 | printf("the area of rectangle is %d", area); 7 | return 0; 8 | } 9 | */ 10 | #include 11 | 12 | int main(){ 13 | int length, breath; 14 | printf("what is the length of rectangle-:\n"); 15 | scanf("%d", &length); 16 | printf("what is the breath of rectangle-:\n"); 17 | scanf("%d", &breath); 18 | printf("the area of rectangle is %d", length*breath); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /102_File_Exist_check.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | int num, num2; 6 | ptr = fopen("sampleC.txt", "r"); 7 | if (ptr==NULL) 8 | { 9 | printf("the file doesnot exist\n"); 10 | } 11 | else 12 | { 13 | printf("the file exists.\n"); 14 | fscanf(ptr, "%d", &num); 15 | fscanf(ptr, "%d", &num2); 16 | printf("the value of num is %d\n", num); 17 | printf("the value of num is %d\n", num2); 18 | fclose(ptr); 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /116_pr05_ch11.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | ptr = (int *) malloc(10 * sizeof(int)); 7 | for (int i = 0; i < 10; i++) 8 | { 9 | ptr[i] = 7*(i+1); 10 | printf("The value of 7 X %d = %d\n", i+1, ptr[i]); 11 | } 12 | printf("***********\n"); 13 | ptr = (int *) realloc(ptr, 15 * sizeof(int)); 14 | for (int i = 0; i < 15; i++) 15 | { 16 | ptr[i] = 7*(i+1); 17 | printf("The value of 7 X %d = %d\n", i+1, ptr[i]); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /112_callocQuiz.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | int n; 7 | printf("Enter the number of integers to be entered.\n"); 8 | scanf("%d", &n); 9 | 10 | ptr = (int *) calloc(n, sizeof(int)); 11 | for (int i = 0; i < n; i++) 12 | { 13 | printf("Enter the value of %d element -:\n", i); 14 | scanf("%d", &ptr[i]); 15 | } 16 | for (int i = 0; i < n; i++) 17 | { 18 | printf("the value of %d element is -: %d\n", i, ptr[i]); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /43_F1_Inside_F2.c: -------------------------------------------------------------------------------- 1 | #include 2 | // Functions inside functions. 3 | void goodMorning(), goodAfternoon(), goodEvening(), goodNight(); 4 | int main() 5 | { 6 | goodMorning(); 7 | return 0; 8 | } 9 | void goodMorning() 10 | { 11 | printf("good morning\n"); 12 | goodAfternoon(); 13 | } 14 | void goodAfternoon() 15 | { 16 | printf("good Afternoon\n"); 17 | goodEvening(); 18 | } 19 | void goodEvening() 20 | { 21 | printf("good Evening\n"); 22 | goodNight(); 23 | } 24 | void goodNight() 25 | { 26 | printf("good Night\n"); 27 | } -------------------------------------------------------------------------------- /50_pr04_ch5.c: -------------------------------------------------------------------------------- 1 | // fibonacci(n) = fibonacci(n-1) + fibonacci(n-2) and fibonacci(1) = 0, fibonacci(2) = 1 2 | #include 3 | int fibonacci(int x); 4 | int main(){ 5 | int a; 6 | printf("enter term no n(i)-:\n"); 7 | scanf("%d", &a); 8 | printf("the fibonacci term n(i) is-:\n%d", fibonacci(a)); 9 | return 0; 10 | } 11 | int fibonacci(int x){ 12 | if (x==1){ 13 | return 0; 14 | } 15 | else if (x==2) 16 | { 17 | return 1; 18 | } 19 | else{ 20 | return fibonacci(x-1) + fibonacci(x-2); 21 | } 22 | } -------------------------------------------------------------------------------- /68_2dArrays.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int n_students = 3; 5 | int n_subjects = 5; 6 | int marks[3][5]; 7 | for(int i=0;i 2 | 3 | int main(){ 4 | int i = 34; 5 | int *j = &i; // j stores the value of address of i. 6 | printf("the value of i is %d\n", i); 7 | printf("the value of i is %d\n", *j); 8 | printf("the value of i is %u\n", *(&i)); 9 | 10 | printf("the address of i is %u\n", j); 11 | printf("the address of i is %u\n", &i); 12 | 13 | printf("the value of j which is also address of i is %u\n", j); 14 | printf("the address of j is %u\n", &j); 15 | printf("the value of j which is also address of i is %u\n", *(&j)); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /91_StructuralArray.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[10]; 8 | }; 9 | int main(){ 10 | struct employee facebook[100]; 11 | facebook[0].code = 100; 12 | facebook[0].salary = 100.54; 13 | strcpy(facebook[0].name, "Aniket"); 14 | 15 | facebook[1].code = 110; 16 | facebook[1].salary = 103.48; 17 | strcpy(facebook[1].name, "Shubham"); 18 | 19 | facebook[2].code = 120; 20 | facebook[2].salary = 111.22; 21 | strcpy(facebook[2].name, "Omar"); 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /15_else_if.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int age; 6 | printf("enter your age\n"); 7 | scanf("%d", &age); 8 | if (age >= 70) 9 | { 10 | printf("you are retired are you getting pensions regularly."); 11 | } 12 | else if (age == 18) 13 | { 14 | printf("start exploring for jobs and internships"); 15 | } 16 | else if (age < 18) 17 | { 18 | printf("study hard."); 19 | } 20 | else // the last else is optional. 21 | { 22 | printf("you have to work till your retirement"); 23 | } 24 | return 0; 25 | } -------------------------------------------------------------------------------- /110_M_Allocation.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | // printf("the size of int in this pc is %d\n", sizeof(int)); 7 | // printf("the size of char in this pc is %d\n", sizeof(char)); 8 | // printf("the size of float in this pc is %d\n", sizeof(float)); 9 | ptr = (int *) malloc(6 * sizeof(int)); 10 | for (int i = 0; i < 6; i++) 11 | { 12 | printf("Enter the value of %d element -:\n", i); 13 | scanf("%d", &ptr[i]); 14 | } 15 | for (int i = 0; i < 6; i++) 16 | { 17 | printf("the value of %d element is -: %d\n", i, ptr[i]); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /55_CallByReference.c: -------------------------------------------------------------------------------- 1 | #include 2 | void wrongSwap(int a, int b); 3 | void swap(int*a, int*b); 4 | int main(){ 5 | int x=3, y=4; 6 | printf("the value of x and y before swap is %d and %d\n", x,y); 7 | // wrongSwap(x,y); // dont work due to call by value. 8 | swap(&x,&y); // will work due to call by reference. 9 | printf("the value of x and y after swap is %d and %d\n", x,y); 10 | return 0; 11 | } 12 | 13 | void wrongSwap(int a, int b){ 14 | int temp; 15 | temp = a; 16 | a = b; 17 | b = temp; 18 | } 19 | 20 | void swap(int *a, int *b){ 21 | int temp; 22 | temp = *a; 23 | *a = *b; 24 | *b = temp; 25 | } 26 | -------------------------------------------------------------------------------- /83_pr02_ch8.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | char str1[34]; 6 | char str2[34]; 7 | char c; 8 | int i = 0; 9 | 10 | printf("Enter the value of str1-:\n"); 11 | scanf("%s", str1); 12 | printf("Enter the value of second string charectar by charectar-:\n"); 13 | 14 | while(c!='\n'){ 15 | fflush(stdin); 16 | scanf("%c", &c); 17 | str2[i]= c; 18 | i++; 19 | } 20 | str2[i-1]='\0'; 21 | printf("the value of str1 is %s\n", str1); 22 | printf("the value of str2 is %s\n", str2); 23 | printf("strcmp for this string returns %d\n", strcmp(str1, str2)); 24 | return 0; 25 | } -------------------------------------------------------------------------------- /19_pr02_ch3.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int phy, chem, math; 5 | float total; 6 | printf("enter phy marks.\n"); 7 | scanf("%d", &phy); 8 | 9 | printf("enter chem marks.\n"); 10 | scanf("%d", &chem); 11 | 12 | printf("enter math marks.\n"); 13 | scanf("%d", &math); 14 | 15 | total = (phy + chem + math)/3; 16 | 17 | if ((total<40) || phy<33 || chem<33 || math<33 ){ 18 | printf("your percentage is percentage is %f and you failed\n", (int)total); // type casting into integers. 19 | } 20 | else{ 21 | printf("your percentage is percentage is %f and you passed\n", (int)total); 22 | } 23 | return 0; 24 | } -------------------------------------------------------------------------------- /97_pr02_ch9.c: -------------------------------------------------------------------------------- 1 | #include 2 | struct vector{ 3 | int x; 4 | int y; 5 | }; 6 | struct vector sumVector(struct vector v1, struct vector v2) 7 | { 8 | struct vector result; 9 | result.x = v1.x + v2.x; 10 | result.y = v1.y + v2.y; 11 | return result; 12 | } 13 | int main(){ 14 | struct vector v1, v2, sum; 15 | v1.x = 34; 16 | v1.y = 54; 17 | printf("x dimension is %d and y dimension is %d\n", v1.x, v1.y); 18 | v2.x = 42; 19 | v2.y = 46; 20 | printf("x dimension is %d and y dimension is %d\n", v2.x, v2.y); 21 | 22 | sum = sumVector(v1, v2); 23 | printf("x dimension of result is %d and y dimension of result is %d\n", sum.x, sum.y); 24 | } -------------------------------------------------------------------------------- /98_pr05_ch9.c: -------------------------------------------------------------------------------- 1 | #include 2 | typedef struct complex{ 3 | int real; 4 | int complex; 5 | }comp; 6 | void display(comp c){ 7 | printf("the value of real part is-: %d\n", c.real); 8 | printf("the value of complex part is-: %d\n", c.complex); 9 | 10 | } 11 | int main(){ 12 | comp cnums[5]; 13 | for (int i = 0; i < 5; i++) 14 | { 15 | printf("Enter the real value for %d num-:\n", i+1); 16 | scanf("%d", &cnums[i].real); 17 | printf("Enter the complex value for %d num-:\n", i+1); 18 | scanf("%d", &cnums[i].complex); 19 | } 20 | for (int i = 0; i < 5; i++) 21 | { 22 | display(cnums[i]); 23 | 24 | } 25 | return 0; 26 | } -------------------------------------------------------------------------------- /18_switchCase.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int rating; 5 | printf("enter your rating (1-5)\n"); 6 | scanf("%d", &rating); 7 | switch (rating) 8 | { 9 | case 1: // 1,2,3,4,5 are naming contants can also name its as case i1. 10 | printf("your rating is 1.\n"); 11 | break; 12 | case 2: 13 | printf("your rating is 2.\n"); 14 | break; 15 | case 3: 16 | printf("your rating is 3.\n"); 17 | break; 18 | case 4: 19 | printf("your rating is 4.\n"); 20 | break; 21 | case 5: 22 | printf("your rating is 5.\n"); 23 | break; 24 | default: 25 | printf("invalid rating"); 26 | break; 27 | } 28 | return 0; 29 | } -------------------------------------------------------------------------------- /94_PassingStructures.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[18]; 8 | }; 9 | void show (struct employee emp){ 10 | printf("employee code is -: %d\n", emp.code); 11 | printf("employee salary is -: %.2f\n", emp.salary); 12 | printf("employee name is -: %s\n", emp.name); 13 | emp.code = 34; 14 | } 15 | int main(){ 16 | struct employee e1; 17 | struct employee *ptr; 18 | 19 | ptr = &e1; 20 | (*ptr).code = 100; 21 | (*ptr).salary = 34.56; 22 | strcpy((*ptr).name, "Aniket"); 23 | show(e1); 24 | printf("employee code is -: %d\n", e1.code); // A structural copy has been given to the function so e1.code doesnt changes. 25 | return 0; 26 | } -------------------------------------------------------------------------------- /20_pr03_ch3.c: -------------------------------------------------------------------------------- 1 | /* income tax question. 2 | 2.5 to 5.0 lakhs === 5% 3 | 5.0 to 10.0 lakhs === 20% 4 | Above 10 lakhs === 30% 5 | */ 6 | #include 7 | 8 | int main() 9 | { 10 | float tax = 0, income; 11 | printf("enter your income.\n"); 12 | scanf("%f", &income); 13 | /* if (income < 2.5) 14 | { 15 | tax = tax; 16 | } 17 | */ 18 | if (income >= 2.5 && income < 5) 19 | { 20 | tax = tax + 0.05 * (income - 2.5); 21 | } 22 | if (income >= 5 && income < 10) 23 | { 24 | tax = tax + 0.20 * (income - 5); 25 | } 26 | if (income >= 10) 27 | { 28 | tax = tax + 0.30 * (income - 10); 29 | } 30 | printf("your net income tax to be paid is %f \n", tax); 31 | return 0; 32 | } -------------------------------------------------------------------------------- /115_pr04_ch11.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | ptr = (int *) malloc(5 * sizeof(int)); 7 | for (int i = 0; i < 5; i++) 8 | { 9 | printf("Enter the value of %d element -:\n", i); 10 | scanf("%d", &ptr[i]); 11 | } 12 | for (int i = 0; i < 5; i++) 13 | { 14 | printf("the value of %d element is -: %d\n", i, ptr[i]); 15 | } 16 | 17 | ptr = (int *) realloc(ptr, 10 * sizeof(int)); 18 | for (int i = 0; i < 10; i++) 19 | { 20 | printf("Enter the value of %d element -:\n", i); 21 | scanf("%d", &ptr[i]); 22 | } 23 | for (int i = 0; i < 10; i++) 24 | { 25 | printf("the value of %d element is -: %d\n", i, ptr[i]); 26 | } 27 | return 0; 28 | } -------------------------------------------------------------------------------- /114_realloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int *ptr; 6 | ptr = (int *) malloc(6 * sizeof(int)); 7 | for (int i = 0; i < 6; i++) 8 | { 9 | printf("Enter the value of %d element -:\n", i); 10 | scanf("%d", &ptr[i]); 11 | } 12 | for (int i = 0; i < 6; i++) 13 | { 14 | printf("the value of %d element is -: %d\n", i, ptr[i]); 15 | } 16 | // reallocation. 17 | ptr = realloc(ptr, 10*sizeof(int)); 18 | for (int i = 0; i < 10; i++) 19 | { 20 | printf("Enter the value of %d element -:\n", i); 21 | scanf("%d", &ptr[i]); 22 | } 23 | for (int i = 0; i < 10; i++) 24 | { 25 | printf("the value of %d element is -: %d\n", i, ptr[i]); 26 | } 27 | return 0; 28 | } -------------------------------------------------------------------------------- /16_else_if.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int num; 6 | int fraudcard=1; 7 | // fraudcard=1; // fraudcard activation. 8 | printf("enter your num\n"); 9 | scanf("%d", &num); 10 | if (num == 45) 11 | { 12 | printf("you won lottery of 1000 rs."); 13 | } 14 | else if (num == 32) 15 | { 16 | printf("you won lottery of 10k rs."); 17 | } 18 | else if (num == 79) 19 | { 20 | 21 | printf("you won a lottery of 1 lakh rs."); 22 | } 23 | else if (fraudcard==1) 24 | { 25 | printf("you won a lottery of 1 lakh rs."); // if won lottery using fraudcard when num = 45,32,79 write its elif above and first. 26 | 27 | } 28 | else 29 | { 30 | printf("you didnt won anything."); 31 | } 32 | } -------------------------------------------------------------------------------- /95_Typedef.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | typedef struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[18]; 8 | } emp; 9 | void show (struct employee emp1){ 10 | printf("employee code is -: %d\n", emp1.code); 11 | printf("employee salary is -: %.2f\n", emp1.salary); 12 | printf("employee name is -: %s\n", emp1.name); 13 | emp1.code = 34; 14 | } 15 | int main(){ 16 | // Declaring e1 and pt. 17 | emp e1; 18 | emp *ptr; 19 | // pointing ptr to e1. 20 | ptr = &e1; 21 | // set the member values for e1. 22 | (*ptr).code = 100; 23 | (*ptr).salary = 34.56; 24 | strcpy((*ptr).name, "Aniket"); 25 | show(e1); 26 | printf("employee code is -: %d\n", e1.code); // Structural cpoy is given to the show so e1.code wont changes. 27 | return 0; 28 | } -------------------------------------------------------------------------------- /72_pr07_ch7.c: -------------------------------------------------------------------------------- 1 | #include 2 | void printTable(int *mulTable, int num, int n){ 3 | printf("The multipulication table of %d is -:\n", num); 4 | for (int i = 0; i < n; i++) 5 | { 6 | mulTable[i] = num*(i+1); 7 | 8 | } 9 | for (int i = 0; i < n; i++) 10 | { 11 | printf("%dX%d = %d\n",num, i+1, mulTable[i]); 12 | } 13 | printf("*******************\n\n"); 14 | } 15 | 16 | int main(){ 17 | int mulTable[3][10]; 18 | // for (int i = 0; i < 10; i++) 19 | // { 20 | // mulTable[0][i] = 2*(i+1); 21 | 22 | // } 23 | // for (int i = 0; i < 10; i++) 24 | // { 25 | // printf("2X%d = %d\n", i+1, mulTable[0][i]); 26 | // } 27 | printTable(mulTable[0], 2, 10); 28 | printTable(mulTable[1], 7, 10); 29 | printTable(mulTable[2], 9, 10); 30 | return 0; 31 | } -------------------------------------------------------------------------------- /40_GuessTheNumber.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main() 5 | { 6 | int number, guess, no_guesses=1; 7 | srand(time(0)); 8 | number = rand() % 100 + 1; 9 | // printf("the number is %d\n", number); 10 | printf("A random no is generated by the system.\n\n"); 11 | do 12 | { 13 | printf("Guess the number between 1 and 100\n\n"); 14 | scanf("%d", &guess); 15 | if (guess>number) 16 | { 17 | printf("Enter a smaller number\n\n"); 18 | } 19 | else if (guess 2 | #include 3 | struct employee 4 | { 5 | int code; 6 | float salary; 7 | char name[10]; 8 | }; 9 | 10 | int main(){ 11 | struct employee e1,e2,e3; 12 | printf("enter the code for e1-: "); 13 | scanf("%d", &e1.code); 14 | printf("enter the salary for e1-: "); 15 | scanf("%f", &e1.salary); 16 | printf("enter the name for e1-: "); 17 | scanf("%s", e1.name); 18 | 19 | printf("enter the code for e2-: "); 20 | scanf("%d", &e2.code); 21 | printf("enter the salary for e2-: "); 22 | scanf("%f", &e2.salary); 23 | printf("enter the name for e2-: "); 24 | scanf("%s", e2.name); 25 | 26 | printf("enter the code for e3-: "); 27 | scanf("%d", &e3.code); 28 | printf("enter the salary for e3-: "); 29 | scanf("%f", &e3.salary); 30 | printf("enter the name for e3-: "); 31 | scanf("%s", e3.name); 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /104_fgetc_fputc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | FILE *ptr; 5 | // ptr = fopen("sampleC2.txt", "r"); 6 | // char c = fgetc(ptr); // reading charectar by charectar 7 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 8 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 9 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 10 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 11 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 12 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 13 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 14 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 15 | // printf("the value of my charectar is %c\n", fgetc(ptr)); 16 | ptr = fopen("sampleC.txt", "w"); 17 | putc('c', ptr); 18 | putc('c', ptr); 19 | putc('c', ptr); 20 | fclose(ptr); 21 | return 0; 22 | } -------------------------------------------------------------------------------- /99_pr09_ch9.c: -------------------------------------------------------------------------------- 1 | #include 2 | typedef struct date{ 3 | int date; 4 | int month; 5 | int year; 6 | }date; 7 | void display(date d){ 8 | printf("the date is %d/%d/%d\n", d.date, d.month, d.year); 9 | } 10 | int dateCmp(date d1, date d2){ 11 | if (d1.year>d2.year){ 12 | return 1; 13 | } 14 | if (d1.yeard2.month){ 18 | return 1; 19 | } 20 | if (d1.monthd2.date){ 24 | return 1; 25 | } 26 | if (d1.date 2 | 3 | int main(){ 4 | int i = 34; // size of integer and float is 4 byte, size of charectar is 1 byte. 5 | int *ptr = &i; 6 | char c = 'h'; 7 | char* cptr = &c; 8 | float f = 4.6; 9 | float* fptr = &f; 10 | printf("the address of i is %u\n", ptr); 11 | ptr++; 12 | printf("the address of i is %u\n", ptr); 13 | ptr--; 14 | printf("the address of i is %u\n", ptr); 15 | ptr = ptr + 2; 16 | printf("the address of i is %u\n", ptr); 17 | ptr = ptr - 1; 18 | printf("the address of i is %u\n\n", ptr); 19 | 20 | printf("the value of cptr is %u\n", cptr); 21 | cptr++; 22 | printf("the value of cptr is %u\n", cptr); 23 | cptr--; 24 | printf("the value of cptr is %u\n", cptr); 25 | cptr = cptr + 2; 26 | printf("the value of cptr is %u\n", cptr); 27 | cptr = cptr - 1; 28 | printf("the value of cptr is %u\n\n", cptr); 29 | 30 | printf("the value of fptr is %u\n", fptr); 31 | fptr++; 32 | printf("the value of fptr is %u\n", fptr); 33 | fptr--; 34 | printf("the value of fptr is %u\n", fptr); 35 | fptr = fptr + 2; 36 | printf("the value of fptr is %u\n", fptr); 37 | fptr = fptr - 1; 38 | printf("the value of fptr is %u\n\n", fptr); 39 | return 0; 40 | } -------------------------------------------------------------------------------- /10_Airth_Instruction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // a and b are operand and +-*/ are airthmatic operators. 4 | int main() 5 | { 6 | int a = 4; 7 | int b = 8; 8 | int z = b * a; 9 | // int b*a = z; //we cant write its illegal. 10 | printf("the value of a + b is: %d\n", a + b); 11 | printf("the value of a - b is: %d\n", a - b); 12 | printf("the value of a * b is: %d\n", a * b); 13 | printf("the value of b / a is: %d\n", b / a); 14 | printf("the value of a / b is: %d\n", a / b); // gives 0 for fractional values as int operator int is a int. 15 | printf("5 when divided by 2 gives a remainder of %d\n", 5 % 2); 16 | printf("5 when divided by 2 gives a remainder of %d\n", -5 % 2);// sign of first operand. 17 | printf("5 when divided by 2 gives a remainder of %d\n", 5 % -2); 18 | printf("5 when divided by 2 gives a remainder of %d\n", -5 % -2);// sign of first operand. 19 | // No operator is assumed to be present we always have to call for operators. 20 | // There is no operator to perform exponentiation 4^5 is logical bitwise XOR operator. 21 | printf("4 raised to the power of 5 is %f\n", pow(4,5)); 22 | printf("the value of 6 + 5 is %d\n", 6 + 5); 23 | printf("the value of 6 + 5.6 is %f\n", 6 + 5.6); 24 | printf("the value of 6.2 + 5.6 is %f\n", 6.2 + 5.6); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /109_Game.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int snakeWaterGun(char you, char computer) 5 | { 6 | if (you == computer) 7 | { 8 | return 0; 9 | } 10 | 11 | if (you == 's' && computer == 'g') 12 | { 13 | return -1; 14 | } 15 | else if (you == 'g' && computer == 's') 16 | { 17 | return 1; 18 | } 19 | 20 | if (you == 's' && computer == 'w') 21 | { 22 | return 1; 23 | } 24 | else if (you == 'w' && computer == 's') 25 | { 26 | return -1; 27 | } 28 | 29 | if (you == 'g' && computer == 'w') 30 | { 31 | return 1; 32 | } 33 | else if (you == 'w' && computer == 'g') 34 | { 35 | return -1; 36 | } 37 | } 38 | 39 | int main() 40 | { 41 | char you, computer; 42 | int number = rand() % 100 + 1; 43 | if (number <= 33) 44 | { 45 | computer = 's'; 46 | } 47 | else if (number > 33 && number < 66) 48 | { 49 | computer = 'w'; 50 | } 51 | else 52 | { 53 | computer = 'g'; 54 | } 55 | printf("Enter 's for Snake, 'w for Water and 'g' for Gun-:\n"); 56 | scanf("%c", &you); 57 | int result = snakeWaterGun(you, computer); 58 | printf("You choosed-: %c\nComputer choosed-: %c.\n", you, computer); 59 | if (result == 0) 60 | { 61 | printf("Game Drawn.\n"); 62 | } 63 | else if (result == 1) 64 | { 65 | printf("You Win.\n"); 66 | } 67 | else 68 | { 69 | printf("You Lose.\n"); 70 | } 71 | return 0; 72 | } -------------------------------------------------------------------------------- /22_pr06_ch3.c: -------------------------------------------------------------------------------- 1 | // greatest of four integers. 2 | #include 3 | 4 | int main() 5 | { 6 | int integer1, integer2, integer3, integer4; 7 | printf("enter integer1 \n"); 8 | scanf("%d", &integer1); 9 | 10 | printf("enter integer2 \n"); 11 | scanf("%d", &integer2); 12 | 13 | printf("enter integer3 \n"); 14 | scanf("%d", &integer3); 15 | 16 | printf("enter integer4 \n"); 17 | scanf("%d", &integer4); 18 | 19 | if (integer1 > integer2) 20 | { 21 | if (integer3 > integer4) 22 | { 23 | if (integer1 > integer3) 24 | { 25 | printf("%d is the greatest", integer1); 26 | } 27 | else 28 | { 29 | printf("%d is the greatest", integer3); 30 | } 31 | } 32 | else 33 | { 34 | if (integer1 > integer4) 35 | { 36 | printf("%d is the greatest", integer1); 37 | } 38 | else 39 | { 40 | printf("%d is the greatest", integer4); 41 | } 42 | } 43 | } 44 | else 45 | { 46 | if (integer3 > integer4) 47 | { 48 | if (integer2 > integer3) 49 | { 50 | printf("%d is the greatest", integer2); 51 | } 52 | else 53 | { 54 | printf("%d is the greatest", integer3); 55 | } 56 | } 57 | else 58 | { 59 | if (integer2 > integer4) 60 | { 61 | printf("%d is the greatest", integer2); 62 | } 63 | else 64 | { 65 | printf("%d is the greatest", integer4); 66 | } 67 | } 68 | } 69 | return 0; 70 | } --------------------------------------------------------------------------------