fa
Feedback
C language basic to Advance

C language basic to Advance

رفتن به کانال در Telegram
380
مشترکین
+724 ساعت
+437 روز
+17030 روز
آرشیو پست ها
Keywords & Identifiers in c language Begginer to advance c course https://youtu.be/bI7vSS3Tf84

Comments in c language and Plateforms to run c codes https://youtu.be/UaN-OaDCx8Q?si=kz5tfAwQKQJpi7Aw

C language for beginners : https://www.youtube.com/playlist?list=PLjEYzWkdEvxv5Byb-QnlQrjsuDuhpXX1G Regular videos: continue with me till full c language

//LCM and HCF #include<stdio.h> int main() { int a, b, i, hcf=1,max; printf("Enter first number:"); scanf("%d",&a); printf("Enter second number:"); scanf("%d",&b); for(i = 1; i <= a || i <= b; i++) { if( a%i == 0 && b%i == 0 ) hcf = i; } max=(a>b)?a:b; while(1) { if(max%a==0 && max%b==0) { break; } max++; } printf("LCM = %d\n",max); printf("HCF = %d", hcf); return 0; }

//Fibonacci sequence and Factorial by using recursion.. #include <stdio.h> int fibo(int a) { if(a==0) return 0; else if(a==1||a==2) return 1; else return fibo(a-1)+fibo(a-2); } void printFiboSeries(int n, int f) { if (f < n) { printf("%d ",fibo(f)); printFiboSeries(n, f + 1); } } int fact(int b) { if(b==0) return 1; else return (b*fact(b-1)); } int main() { int n,f; printf("Enter the terms:"); scanf("%d",&n); printf("Fibonacci sequence:"); printFiboSeries(n,0); printf("\nFactorial of given number:%d",fact(n)); return 0; }

//Transpose of Matrix.. #include<stdio.h> int main() {     int row, column;     printf("Enter row and column of Matrix:");     scanf("%d %d",&row,&column);       if (row <= 0 || column <= 0) {            printf("Error!! Row and column values must be positive integers.\n");            return 1;                 }     int a[row][column];     for(int r=0; r<row; r++) {         for(int c=0; c<column; c++) {             printf("Enter element A[%d%d] :",r,c);             scanf("%d",&a[r][c]);         }     }     printf("\nMatrix:\n");     for(int r=0; r<row; r++) {         for(int c=0; c<column; c++) {             printf("%d  ",a[r][c]);         }         printf("\n");     }     printf("\nTranspose of Matrix:\n");     for(int r=0; r<column; r++) {         for(int c=0; c<row; c++) {             printf("%d  ",a[c][r]);         }         printf("\n");     }     return 0; }

//Addition of two Matrices.. #include <stdio.h> int main() {     int row, column;     printf("Enter the number of rows and columns: ");     scanf("%d %d", &row, &column);     if (row <= 0 || column <= 0) {         printf("Error: Row and column values must be positive integers.\n");         return 1;     }     int a[row][column], b[row][column];     printf("\nEnter values for matrix A:\n");     for (int r = 0; r < row; r++) {         for (int c = 0; c < column; c++) {             printf("Enter row %d and column %d: ", r, c);             scanf("%d", &a[r][c]);         }     }     printf("\nEnter values for matrix B:\n");     for (int r = 0; r < row; r++) {         for (int c = 0; c < column; c++) {             printf("Enter row %d and column %d: ", r, c);             scanf("%d", &b[r][c]);         }     }     printf("\nMatrix A:\n");     for (int r = 0; r < row; r++) {         for (int c = 0; c < column; c++) {             printf("%d  ", a[r][c]);         }         printf("\n");     }     printf("\nMatrix B:\n");     for (int r = 0; r < row; r++) {         for (int c = 0; c < column; c++) {             printf("%d  ", b[r][c]);         }         printf("\n");     }     printf("\nSum of Matrix A and Matrix B:\n");     for (int r = 0; r < row; r++) {         for (int c = 0; c < column; c++) {             printf("%d  ", a[r][c] + b[r][c]);         }         printf("\n");     }     return 0; }

//performs different operations on two numbers... #include<stdio.h> int add(int k,int l) {     return k+l; } int sub(int k,int l) {     return k-l; } int multi(int k,int l) {     return k*l; } float div(int k,int l) {     return k/(float)l; } int main() {     int a,b;     char Op;     printf("Enter first number: ");     scanf("%d",&a);     printf("Enter second number: ");     scanf("%d",&b);     printf("Enter Operator: ");     scanf(" %c",&Op);     switch(Op) {     case'+':         printf("Addition of two numbers: %d",add(a,b));         break;     case'-':         printf("Subtraction of two numbers: %d",sub(a,b));         break;     case'*':         printf("Multiplication of two numbers: %d",multi(a,b));         break;     case'/':         if(b==0)             printf("Division by zero not possible");         else             printf("Division of two numbers: %.3f",div(a,b));         break;     default:         printf("Error!Enter correct operator");     }     return 0; }

// Decimal to binary conversion with steps #include <stdio.h> void integer(int intgr) {   if (intgr < 1)     return;   printf("Now dividing decimal by 2:\n");   char temp[32];   int index = 0;   while (intgr > 0) {     printf("%d / 2    reminder %d\n", intgr, intgr % 2);     temp[index++] = intgr % 2 + '0';     intgr = intgr / 2;   }   printf("\nBinary is ");   for (int i = index - 1; i >= 0; i--) {     printf("%c", temp[i]);   }   printf("\n"); } int main() {   int dcml; printf("Enter decimal number: "); scanf("%d", &dcml); int intgr = (int)dcml;   printf("Given decimal %d\n\n", dcml);   integer(intgr);   return 0; }

// Series answer #include <stdio.h> #include <math.h> int main() { float ans = 1.0, temp = 1.0, x = 2.0; int iterations = 3; for (int i = 1; i <= iterations; i++) { temp = temp * x / i; ans += temp; } printf("Result from series expansion: %f\n", ans); float expResult = exp(x); printf("Result from inbuilt function (exp()): %f\n", expResult); if (fabs(ans - expResult) < 0.0001) { printf("The results match.\n"); } else { printf("The results do not match.\n"); } return 0; } // @C_code5 // Computer related numerical techniques

╱╱┏╮ ╱╱┃┃ ▉━╯┗━╮ ▉┈┈┈┈┃ ▉╮┈┈┈┃ ╱╰━━━╯ I hope you like it

// Pascal's triangle pattern #include <stdio.h> int binomialCoeff(int n, int k) {     int res = 1;     if (k > n - k)         k = n - k;     for (int i = 0; i < k; i++) {         res *= (n - i);         res /= (i + 1);     }     return res; } void printPascalTriangle(int n) {     for (int line = 0; line < n; line++) {         for (int i = 0; i <= n - line - 2; i++) {             printf(" ");         }         for (int i = 0; i <= line; i++) {             printf("%d ", binomialCoeff(line, i));         }         printf("\n");     } } int main() {     int n;     printf("Enter the number of rows for Pascal's triangle: ");     scanf("%d", &n);     printf("Pascal's triangle:\n");     printPascalTriangle(n);     return 0; }

// Run and see its output #include <stdio.h> int main() { int unicodeValues[] = {240, 159, 135, 174, 240, 159, 135, 179, 72, 97, 112, 112, 121, 32, 73, 110, 100, 101, 112, 101, 110, 100, 101, 110, 99, 101, 32, 100, 97, 121}; int length = sizeof(unicodeValues) / sizeof(unicodeValues[0]); for (int i = 0; i < length; i++) { printf("%c", unicodeValues[i]); } printf("\n"); return 0; }

// Colored Hindu Dharm flag and arrow scale up effect @C_code5 // Used Function, Pointer, Header file #include<stdio.h> #include<unistd.h> void enterNum(int *n, int *e) {     system("clear");     printf("Enter Number to print triangle: ");     scanf("%d",n);     printf("Enter Number triangle executing time: ");     scanf("%d",e); } void displayTriangle(int n, int e) {     printf("\033[0;31m");     for(int i=n,m=n,k=1; i>0; i--,k+=2,m--) {         for(int b=0; m>b; b++) {             if(n<12)                 printf("  ");             else                 printf(" ");         }         usleep(e*10000);         for(int j=0; j<k; j++) {             printf("*");         }         printf("\n");     } } int displayLine(int n, int e) {     printf("\033[0;36m");     int ii=0,*t=0;     while(ii<5) {         for(int j=0; j<n+1; j++) {             if(j<n) {                 if(n<12) {                     printf("  ");                     t = 1;                 }                 else                     printf(" ");             }             else {                 usleep(e*10000);                 printf("*\n");             }         }         ii++;     }     if(t==1)         return 1;     else         return 0; } int main() {     int n,e,Loop=0;     enterNum(&n, &e);     while(9>Loop++) {         displayTriangle(n,e);         int com = displayLine(n, e);         printf("%d",Loop);         if(com == 1) {             usleep(e*10000);             printf(": Jay Shree Ram\n\n");         }         else         printf("\n\n");     }     return 0; }

All Codes @C_Code5 @CPP_Coding @Python_Codes_Pro @Java_Codes_Pro @jsCode0 Diffrent free Compiler bots For group @CodeCompiler_Bot For channel @IOChannel_bot For Channel Cmpl @Compiler0bot For inline @cmpbbot info in @LogicBots Discussion @bca_mca_btech

/* Recursion in C involves a function calling itself directly or indirectly. Here's an example of a recursive function in C: */ #include <stdio.h> void countdown(int n) {     if (n > 0) {         printf("%d ", n);      // Print the current number         countdown(n - 1);     // Call the function itself with a smaller number     } } int main() {     int num = 5;     countdown(num);     return 0; } // @C_code5

#include <stdio.h> void bubbleSort(int arr[], int n) {     for (int i = 0; i < n - 1; i++) {         for (int j = 0; j < n - i - 1; j++) {             if (arr[j] > arr[j + 1]) {                 // Swap arr[j] and arr[j+1]                 int temp = arr[j];                 arr[j] = arr[j + 1];                 arr[j + 1] = temp;             }         }     } } int main() {     int numbers[] = {6, 2, 10, 12, 89, 34, 99, 31, 5};     int n = sizeof(numbers) / sizeof(numbers[0]);     printf("Original list: \n");     for (int i = 0; i < n; i++) {         printf("%d ", numbers[i]);     }     bubbleSort(numbers, n);     printf("\n\nSorted list (ascending order): \n");     for (int i = 0; i < n; i++) {         printf("%d ", numbers[i]);     }     return 0; } // @C_code5

print("Hi What's you think about this running Features say me on @bca_mca_btech group")

#include void bubbleSort(int arr[], int n) { &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; n - 1; i++) { &nbsp;&nbsp;&nbsp;&nbsp;
#include <stdio.h> void bubbleSort(int arr[], int n) {     for (int i = 0; i < n - 1; i++) {         for (int j = 0; j < n - i - 1; j++) {             if (arr[j] > arr[j + 1]) {                 // Swap arr[j] and arr[j+1]                 int temp = arr[j];                 arr[j] = arr[j + 1];                 arr[j + 1] = temp;             }         }     } } int main() {     int numbers[] = {6, 2, 10, 12, 89, 34, 99, 31, 5};     int n = sizeof(numbers) / sizeof(numbers[0]);     printf("Original list: \n");     for (int i = 0; i < n; i++) {         printf("%d ", numbers[i]);     }     bubbleSort(numbers, n);     printf("\n\nSorted list (ascending order): \n");     for (int i = 0; i < n; i++) {         printf("%d ", numbers[i]);     }     return 0; } // @C_code5