Skip to content
कोडिंग मराठी /Coding Marathi

कोडिंग मराठी /Coding Marathi

Learn coding in मराठी

  • होम पेज/Home
  • Tools/ साधने
  • ब्लॉग्स/Blogs
    • संग्रही/Archive
  • प्रोजेक्ट/Mini Projects
    • Machine Learning Project Ideas for All Skill Levels.
    • Java Programming Free Projects idea’s
    • C Programming free projects idea’s
      • C programming basic
    • C plus plus free project for Beginners.
    • PHP free projects idea’s
    • Free SQL project idea’s.
    • Free IOT project Ideas
  • अबाऊट/About me
  • कॉनटॅक्ट/Contact Us
  • Privacy Policy

C programming basic

  • Algebraic function:
  • String functions:

Basic Algebraic Functions:

C programming basic algebraic operations such as addition, subtraction, multiplication, and division using the built-in arithmetic operators.

#include <stdio.h>

int main()
{
    int a = 5;
    int b = 2;
    int c;

    // Addition
    c = a + b;
    printf("%d + %d = %d\n", a, b, c);

    // Subtraction
    c = a - b;
    printf("%d - %d = %d\n", a, b, c);

    // Multiplication
    c = a * b;
    printf("%d * %d = %d\n", a, b, c);

    // Division
    c = a / b;
    printf("%d / %d = %d\n", a, b, c);

    return 0;
}
 
Output

The modulus operator (%) to find the remainder of a division operation.

For example:

#include <stdio.h>

int main()
{
    int a = 7;
    int b = 2;
    int c;

    c = a % b;
    printf("%d %% %d = %d\n", a, b, c);

    return 0;
}
Output

String functions:

In C programming, you can use the string concatenation operator (strcat) to concatenate (combine) two strings. The strcat function is defined in the string.h header file, so you will need to include this file at the top of your program.

Example of strcat:

#include <stdio.h>
#include <string.h>

int main()
{
    char s1[100] = "Hello";
    char s2[100] = ", world!";
    char s3[200];

    strcat(s3, s1);
    strcat(s3, s2);

    printf("%s\n", s3);

    return 0;
}

You can also use the strncat function to concatenate a specified number of characters from one string to another.

For example:

#include <stdio.h>
#include <string.h>

int main()
{
    char s1[100] = "Hello";
    char s2[100] = ", world!";
    char s3[200];

    strncat(s3, s1, 5);
    strncat(s3, s2, 7);

    printf("%s\n", s3);

    return 0;
}

You can also use the strcmp function to compare two strings. The strcmp function returns 0 if the two strings are equal, a negative value if the first string is less than the second string, and a positive value if the first string is greater than the second string.

You can also use the strcmp function to compare two strings. The strcmp function returns 0 if the two strings are equal, a negative value if the first string is less than the second string, and a positive value if the first string is greater than the second string.

Here is an example of using the strcmp function:

#include <stdio.h>
#include <string.h>

int main()
{
    char s1[100] = "Hello";
    char s2[100] = "Hello";
    char s3[100] = "World";

    int cmp1 = strcmp(s1, s2);
    int cmp2 = strcmp(s1, s3);

    printf("%d\n", cmp1);
    printf("%d\n", cmp2);

    return 0;
}

Do subscribe on YouTube for the tutorials on C programming basic and from more code go to my GitHub profile. Comment down any query, I will try to solve them as soon as possible.

  • अबाऊट/About me
  • कॉनटॅक्ट/Contact Us
  • Privacy Policy
  • GitHub
  • YouTube
  • Instagram
  • Facebook

Copyright © 2025 कोडिंग मराठी /Coding Marathi.

Theme: Oceanly by ScriptsTown