Posts

pattern practice in c ⌨️๐Ÿ’ป

Image
#include <stdio.h> //codewithsandhan void main() {     int a, x, y;     while (1)     {         printf("\nEnter a number :   ");         scanf("%d", &a);         for (y = a; y >= -a; y--)         {             for (x = -a; x <= a; x++)             {                 if (x == 0 || y == 0 || x == -y || x == y)                 {                     printf("%c", 64 + x);                 }                 else                 {                     printf(" ");                 }                 if (x == a)                 {                     printf("\n");                 }             }         }     } }

๐Ÿ˜Ž diamond structure in c programming

Image
#include <stdio.h> //@codewithsandhan void main() {     int i, j, a;     printf("Enter a number:    ");     scanf("%d", &a);     for (i = a; i >= -a; i--)     {         for (j = -a; j <= a; j++)         {             if ((j <= 3.4 * a / 5 && j >= -3.4 * a / 5 && i == 4 * a / 5) || (i == j + a + 12 * a / 25 && i < 4 * a / 5 && i >= a / 5) || (i == -j + a + 12 * a / 25 && i < 4 * a / 5 && i >= a / 5) || (i == -j - 14 * a / 25 && i < 2.5 * a / 5 && i > -2.8 * a / 5) || (i == j - 14 * a / 25 && i >= -2.8 * a / 5))             {                 printf("*");             }             else             {                 printf(" ");             }             if (j == a)             {                 printf("\n");             }         }     } }

๐Ÿ˜Ž unique shapes output using c programming ...

Image
#include <stdio.h> //@codewithsandhan void main() {     int i, j, a, k = 1;     while (k > 0)     {         printf(" \U0001F600 Enter a number : ");         scanf("%d", &a);         printf("\n\n");         for (i = a; i >= -a; i--)         {             for (j = -a; j <= a; j++)             {                 if (i == 0 || j == 0 || i == -j || i == j || i == -a || i == a || j == -a || j == a || (j > -7 * a / 25 && j < 6 * a / 25 && i < 5 * a / 25 && i > -5 * a / 25))                 {                     printf("*");                 }                 else                 {                     printf(" ");                 }                 if (j == a)                 {                     printf("\n");                 }             }         }         k++;         printf("\n\n");     } }

print C

Image
#include <stdio.h> void main() //@codewithsandhan {     int i, j, a, k, l;     printf("Enter a number : ");     scanf("%d", &a);     for (i = 1; i <= a; i++)     {         if (i == 1)         {             for (j = 1; j <= 110 * a / 70; j++)             {                 if (j < 100 * a / 130)                 {                     printf(" ");                 }                 else                 {                     printf("\U0001F921");                 }             }         }         if (i == a)         {             for (j = 1; j <= 110 * a / 70; j++)             {                 if (j < 100 * a / 130)                 {                     printf(" ");                 }                 else                 {                     printf("\U0001F921");                 }             }         }         printf("\n");         if (i < a / 4)         {             for (k = 1; k < a / 4

SOLUTION OF TWO VARIABLES LINEAR EQUATIONS

Image
#include <stdio.h> void main() {     //@codewithsandhan     float a1, b1, c1, a2, b2, c2, x, y;     printf("      \U0001F610   SOLUTION OF TWO VARIABLES LINEAR EQUATIONS !!!!\n\n\n");     printf("      equation 1   =>     \U0001F560       a1.x  +  b1.y  +c1  =  0  \n      equation 2   =>     \U0001F560       a2.x  +  b2y  + c2  =  0  \n\n");     printf("        \U0001F913   Enter the value of a1 :  ");     scanf("%f", &a1);     printf("\n        \U0001F913   Enter the value of b1 :  ");     scanf("%f", &b1);     printf("\n        \U0001F913   Enter the value of c1 :  ");     scanf("%f", &c1);     printf("\n\n");     printf("        \U0001F920   Enter the value of a2 :  ");     scanf("%f", &a2);     printf("\n        \U0001F920   Enter the value of b2 :  ");     scanf("%f", &b2);     printf("\n        \U0001F920   Enter th

codes for solution of quadratic equations.

#include <stdio.h> #include <math.h> void main() {     //@codewithsandhan     float a, b, c, x, D, x1, x2;     printf("\n\n     \U0001F637   SOLUTIONS OF QUADRATIC EQUATION OF SINGLE VARIABLR  !!!!\n\n\n");     printf("     \U0001F917   Equation should be like     ax^2 + xb + c = 0   \n\n\n  ");     printf("         \U0001F600   Enter the value of a : ");     scanf("%f", &a);     printf("\n           \U0001F600     Enter the value of b : ");     scanf("%f", &b);     printf("\n           \U0001F600    Enter the value of c : ");     scanf("%f", &c);     printf("\n\n");     x = (b * b) - (4 * a * c);     if (x > 0)     {         x1 = (-b + pow(x, 0.5)) / (2 * a);         x2 = (-b - pow(x, 0.5)) / (2 * a);         printf(" \n     \U0001F616    roots are real and distincts .\n\n");         printf("\n\n   \U0001F618  x1 =%.3f      \U0001F618   x2 = %.3f\n",