Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

C Assignment Operators

// Working of assignment operators
#include <stdio.h>
int main()
{
    int a = 5, c;
    c = a;      // c is 5
    printf("c = %d
", c);
    c += a;     // c is 10 
    printf("c = %d
", c);
    c -= a;     // c is 5
    printf("c = %d
", c);
    c *= a;     // c is 25
    printf("c = %d
", c);
    c /= a;     // c is 5
    printf("c = %d
", c);
    c %= a;     // c = 0
    printf("c = %d
", c);
    return 0;
}
 
PREVIOUS NEXT
Tagged: #C #Assignment #Operators
ADD COMMENT
Topic
Name
7+3 =