└── code with harry c lan ├── smit_admit_card.pdf ├── UltimateJavaCheatSheet.pdf ├── chap_5--(functon).c ├── chap1_pratice_question.c ├── chap3_questions.c ├── chap_3.c ├── fabinnaci.c └── chapter_2.c /code with harry c lan/smit_admit_card.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/CWH_C-language/HEAD/code with harry c lan/smit_admit_card.pdf -------------------------------------------------------------------------------- /code with harry c lan/UltimateJavaCheatSheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/CWH_C-language/HEAD/code with harry c lan/UltimateJavaCheatSheet.pdf -------------------------------------------------------------------------------- /code with harry c lan/chap_5--(functon).c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | //void gm(){ 6 | // printf("GOOD MORNING\n"); 7 | //} 8 | // 9 | //void ge(){ 10 | // printf("GOOD EVENING\n"); 11 | //} 12 | // 13 | //void gn(){ 14 | // printf("GOOD NIGHT\n"); 15 | //} 16 | // 17 | // 18 | // 19 | //int main(int argc, char *argv[]) { 20 | // gm(); 21 | // ge(); 22 | // gn(); 23 | // 24 | // return 0; 25 | //} 26 | 27 | 28 | int main(int argc, char *argv[]) { 29 | int res; 30 | res=sum(45,5); 31 | printf("%d",res); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /code with harry c lan/chap1_pratice_question.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | int main(int argc, char *argv[]) { 7 | //QUEATION1:- 8 | // int length, breadth; 9 | // 10 | // printf("What is the length of your rectangle="); 11 | // scanf("%d", &length); 12 | // 13 | // printf("What is the breadth of your rectangle="); 14 | // scanf("%d", &breadth); 15 | // 16 | // printf("The area of your rectangle is %d",length*breadth); 17 | 18 | 19 | //QUEATION2:- 20 | // int radius=4; 21 | // float pi=3.142; 22 | // printf("The value of area of circle is %f\n",pi*radius*radius); 23 | // int height=4; 24 | // printf("The volume of cylinder is %f\n",pi*radius*radius*height); 25 | 26 | 27 | //QUEATION3:- 28 | //float calcius=37 , fahrenheit; 29 | //fahrenheit=(calcius*9/7)+32; 30 | //printf("The normal body temprature of body in fahrenheit %f",fahrenheit); 31 | 32 | ////QUEATION4:- 33 | int principle=100 , rate=0 , year=10010; 34 | int simpleinterest=principle*rate*year; 35 | printf("The simpleinterest rate of any preson is %d",simpleinterest); 36 | 37 | 38 | 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /code with harry c lan/chap3_questions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | int main(int argc, char *argv[]) { 7 | 8 | 9 | //Q.2 10 | 11 | // int physics; 12 | // int chemistry; 13 | // int math; 14 | // float total; 15 | // 16 | // printf("Enter the marks of physics="); 17 | // scanf("%d",&physics); 18 | // 19 | // printf("Enter the marks of chemistry="); 20 | // scanf("%d",&chemistry); 21 | // 22 | // printf("Enter the marks of math="); 23 | // scanf("%d",&math); 24 | // 25 | // total=(physics + chemistry + math)/3; 26 | // 27 | // if((total<40) || physics<33 || chemistry<33 || math<33 ){ 28 | // printf("your percentage is %f and you are fail",total); 29 | // } 30 | // else{ 31 | // printf("your percentage is %f and you are pass",total); 32 | // } 33 | // 34 | 35 | 36 | 37 | // int i ,j ; 38 | // for(i=1;i<=4;i++){ 39 | // for(j=1;j<=i;j=j+2){ 40 | // printf("%d",j); 41 | // } 42 | // printf("\n"); 43 | // } 44 | 45 | 46 | 47 | 48 | //int x , y; 49 | //for(x=1;x<=10;x++){ 50 | //for(y=1;y<=x;y++){ 51 | // printf("%d \t",y*y); 52 | // } 53 | // printf("\n"); 54 | // } 55 | 56 | //'============================================================== 57 | 58 | 59 | 60 | //char character; 61 | //printf("Enter the character:"); 62 | //scanf("%d",&character); 63 | //if(character<=122 && character>=97 ){ 64 | // printf("The character is lowercase"); 65 | //} 66 | //else{ 67 | // printf("The character is lowercase"); 68 | //} 69 | 70 | 71 | 72 | //====================================================== 73 | 74 | //int i; 75 | //scanf("%d",&i); 76 | //while(i<10){ 77 | // printf("The number is %d\n",i); 78 | // i++; 79 | //} 80 | 81 | //int i=0; 82 | //while(i<10){ 83 | // printf("%d",i); 84 | // i++; 85 | //} 86 | 87 | 88 | 89 | //int i=0; 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | printf("h"); 125 | 126 | 127 | 128 | 129 | 130 | return 0; 131 | } 132 | -------------------------------------------------------------------------------- /code with harry c lan/chap_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | int main(int argc, char *argv[]) { 7 | // Condition statements :- used when we have conditions or options.. 8 | // types of Condition statements 9 | // 1. if else Condition 10 | // 2. switch Condition 11 | // ------"IF ELSE"--------- 12 | //===========================================================// 13 | 14 | 15 | // Q.cheak weather the number is even or odd ? (single condition) 16 | //Answer:- 17 | //int a; 18 | //printf("Enter your number="); 19 | //scanf("%d",&a); 20 | //if(a%2==0){ 21 | // printf("%d number is even ",a); 22 | //} 23 | //else{ 24 | // printf("%d number is odd",a); 25 | //} 26 | 27 | //------------------------------------------------------------ 28 | 29 | // Q.write a program to check wather age is greater then 18 then user is able to drive else greater then 90 or less than 18 user is not able to drive ? 30 | // 31 | //int age; 32 | //printf("enter your age="); 33 | //scanf ("%d", &age); 34 | //if(age>=18){ 35 | // printf("you are eligibe to derive"); 36 | //} 37 | //if(age<18){ 38 | // printf("your age is blow 18 you are not eligibe to derive"); 39 | //} 40 | //if(age>=90){ 41 | // printf("your age is so above you are not able to drive"); 42 | //} 43 | //else{ 44 | // 45 | //} 46 | 47 | //---------------------------------------------------------------- 48 | 49 | //Logical operators:- there are three logical operators 50 | //1. AND (&&) 51 | 52 | //int age; 53 | //printf("enter your age="); 54 | //scanf ("%d", &age); 55 | //if((age>=18)&&(age<90)) { 56 | // printf("your age is blow 90 and above 18 you are can eligibe to derive"); 57 | //} 58 | //else{ 59 | // printf("you cannot drive"); 60 | // } 61 | 62 | //------------------------ 63 | 64 | //2. OR (||) 65 | 66 | //int age ; 67 | //int vippass=1 ; 68 | //printf("enter your age="); 69 | //scanf ("%d", &age); 70 | //if((age>=18)&&(age<90)||(vippass==1)) { 71 | // printf("you can drive"); 72 | //} 73 | 74 | //------------------------- 75 | 76 | //3. NOT (!) 77 | 78 | //int a=4; 79 | //if(a!=3){ 80 | //printf("hello"); 81 | //} 82 | 83 | //==================================================== 84 | 85 | // ------"IF ELSE"--------- 86 | 87 | //int num ; 88 | //printf("enter your num="); 89 | //scanf ("%d", &num); 90 | //if(num==2){ 91 | // printf("you get 2GP"); 92 | //} 93 | //else if(num==3){ 94 | // printf("you get 3GP"); 95 | //} 96 | //else if(num==4){ 97 | // printf("you get 4GP"); 98 | //} 99 | //else{ 100 | // printf("you are fee dfolder"); 101 | //} 102 | 103 | //======================================================// 104 | 105 | //Shorthand of if-else is condition/ternary operator(one line operator)// 106 | 107 | int a; 108 | printf("enter number"); 109 | scanf("%d",&a); 110 | 111 | (a<2)? printf("your number is not greater than 2"): printf("your number is greater than 2"); 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | return 0; 134 | } 135 | -------------------------------------------------------------------------------- /code with harry c lan/fabinnaci.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | int main(int argc, char *argv[]) { 7 | // int i , j ; 8 | // for(i=1;i<=5;i+=2){ 9 | // for(j=1;j<=i;j+=2){ 10 | // printf("%d",j); 11 | // } 12 | // printf("\n"); 13 | // } 14 | 15 | 16 | //int i , j; 17 | //for(i=1;i<=5;i++){ 18 | // for(j=1;j>=i;j+=2){ 19 | // printf("%d",j); 20 | // } 21 | // printf("\n"); 22 | //} 23 | 24 | 25 | 26 | //int i=4 , j=12; 27 | //if(i=5||j>50){ 28 | // printf("hello"); 29 | //}else{ 30 | // printf("hi"); 31 | //} 32 | 33 | 34 | 35 | //int i=4 ,j=-1 ,k=0 ,w; 36 | //w=i||j||k; 37 | //printf("%d",w); 38 | 39 | 40 | //int i , factorial=1 , num ; 41 | // 42 | //printf("Enter number:"); 43 | //scanf("%d",&num); 44 | // 45 | //for(i=1;i<=num;i++){ 46 | // factorial = factorial * i; 47 | //} 48 | // 49 | //printf("The Factorial of %d is: %d", num , factorial); 50 | 51 | 52 | 53 | // int num,i; 54 | // scanf("%d",&num); 55 | // for(i=1;i<=num;i++){ 56 | // printf("the number is %d cube of %d is : %d.\n",i , i ,(i*i*i)); 57 | // } 58 | 59 | 60 | 61 | 62 | //int i ; 63 | //for(i=1;i<=10;i++){ 64 | // printf("15*%d=%d\n",i,(15*i)); 65 | //} 66 | 67 | 68 | //int j,i,n; 69 | // printf("Input upto the table number starting from 1 : "); 70 | // scanf("%d",&n); 71 | // printf("Multiplication table from 1 to %d \n",n); 72 | // for(i=1;i<=10;i++) 73 | // { 74 | // for(j=1;j<=n;j++) 75 | // { 76 | // // if (j<=n-1) 77 | // printf("%dx%d = %d,\t ",j,i,i*j); 78 | // // else 79 | // //\0 printf("%dx%d = %d \t",j,i,i*j); 80 | // 81 | // } 82 | // printf("\n"); 83 | // } 84 | 85 | 86 | 87 | 88 | 89 | //int i , j , num; 90 | //scanf("%d",&num); 91 | //for(i=1;i<=10;i++){ 92 | // for(j=1;j<=num;j++){ 93 | // printf("%d x %d = %d\t",i,j,(j*i)); 94 | // } 95 | // printf("\n"); 96 | //} 97 | 98 | 99 | 100 | //int i ,j ,num ,sum=0; 101 | //printf("Enter Number:"); 102 | //scanf("%d",&num); 103 | // for(i=1;i<=num;i+=2){ 104 | // printf("%d,",i); 105 | // sum=sum+i; 106 | // } 107 | // printf("\nThe sum of odd num is : %d",sum); 108 | // 109 | 110 | 111 | //int i,j; 112 | //for(i=1;i<=5;i++){ 113 | // for(j=1;j<=i;j++){ 114 | // printf("*"); 115 | // } 116 | // printf("\n"); 117 | //} 118 | 119 | 120 | //int i ,j ; 121 | //for(i=1 ; i<=5 ; i++){ 122 | // for(j=1;j<=i;j++){ 123 | // printf("%d",i); 124 | // } 125 | // printf("\n"); 126 | //} 127 | 128 | 129 | int i , j , row , k=1 ; 130 | printf("Input number of rows : "); 131 | scanf("%d",&row); 132 | for(i=1;i<=row;i++) 133 | { 134 | for(j=1;j<=i;j++){ 135 | printf("%d ",k++); 136 | } 137 | printf("\n"); 138 | } 139 | 140 | 141 | 142 | 143 | // int i,j,rows,k=1; 144 | // printf("Input number of rows : "); 145 | // scanf("%d",&rows); 146 | // for(i=1;i<=rows;i++) 147 | // { 148 | // for(j=1;j<=i;j++) 149 | // printf("%d ",k++); 150 | // printf("\n"); 151 | // } 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | return 0; 186 | } 187 | -------------------------------------------------------------------------------- /code with harry c lan/chapter_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | int main(int argc, char *argv[]) { 7 | //instruction and operators 8 | //1. decleartion_instrucation 9 | // int a=4 ,b=4 ,c =3.9; 10 | // printf("The value of a is %d \n",a); 11 | // printf("The value of b is %d \n",b); 12 | // printf("The value of c is %d",c); 13 | // 14 | 15 | // float a =3.9; 16 | // float b =4.1; 17 | // printf("The value of a is %f\n",a); 18 | // printf("The valye of b is %f\n",b); 19 | // 20 | //2.artimatic_instruction 21 | 22 | // int point=14; 23 | // int point_2=15; 24 | // int main; 25 | // main = point+point_2; 26 | 27 | // printf("The value of point+point_2 is %d \n",main); 28 | // printf("The value of point+point_2 is %d \n",point+point_2); 29 | // printf("The value of piont-piont_2 is %d\n",point-point_2); 30 | // printf("The value of piont*piont_2 is %d\n",point*point_2); 31 | // printf("The value of piont/piont_2 is %d\n",point/point_2); 32 | //int a=5 , b=-2; 33 | //printf("When 5 is divided by -2 it leaves remainder %d ",5%-2); 34 | 35 | // no operator assumed 36 | // printf("The value of 4*3 is %d", (4)(3)); 37 | 38 | //Type conversion 39 | //int+float=float 40 | //int+float=float 41 | //printf("The value of 39+44 is %d\n",39+44); //int+int=int 42 | //printf("The value of 39+4.4 is %f\n",39+4.4); //int+flat=float 43 | //printf("The value of 3.9+4.4 is %f\n",3.9+4.4); //float+float=float 44 | // quiz:- 45 | //Q.1:What is the value of k+3/9? and why ? 46 | //float K=3.0/9; 47 | //printf("The value of 3.0/9 is %f", 3.0/9 ); 48 | 49 | //===========================================================// 50 | 51 | //pratice question:- 52 | 53 | //Q.1:determind the following are the vaild or invaild? 54 | //(a)int a=4, b=a; 55 | //ans::int a=4 , b=a: (invaild) 56 | 57 | //(b)int v=3^3; 58 | 59 | //// ans:: vaild but not give answer 60 | 61 | //int v=3^3; 62 | //printf("%d",v); 63 | 64 | //-------------------------------------------------- 65 | 66 | //Q.2:-What will be the data type of 3/8-2 reture? 67 | 68 | //Answer:- 69 | 70 | // flaot or double... 71 | //double x=3/8-2; 72 | //printf("%f",x); 73 | 74 | //------------------------------------------- 75 | 76 | //Q.3:-write a program to determind the number wather the number is divisible by 97 or not? 77 | 78 | //Answer:- 79 | 80 | // int num; 81 | // printf("Enter your number"); 82 | // scanf("%d",&num); 83 | // printf("Divisility test result %d",num%97); //if the result is 0 then the num is divisible to 97. 84 | 85 | //-------------------------------------------- 86 | 87 | //Q.4:-step by step evluation of 3*x/y-z+k where x=2 , y=3 , z=3 , k=1 ? 88 | 89 | //int x=2 , y=3 , z=3 , k=1; 90 | //int result = 3*x/y-z+k ; 91 | // 92 | //// 3*2/2-3+1 93 | //// 6/2-3+1 94 | //// 2-3+1 95 | //// 0 96 | // 97 | //printf("The result is %d",result); 98 | 99 | //------------------------------------------ 100 | 101 | //Q.5:-3/+1 will be ? 102 | //(a) integer 103 | //(b)floating point number -------------------- //correct anwser 104 | //(c)character 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | return 0; 133 | 134 | 135 | } 136 | --------------------------------------------------------------------------------