Skip to main content

2) C program to add two number.

→ Program to add two numbers and print.

#include<stdio.h>
int main()
{
   int a,b,c;
   a=8;
   b=9;
   c=a+b;
   printf("Addition of %d and %d is %d", a,b,c);

  return 0;
 }

Output: Addition of 8 and 9 is 17

Comments

Popular posts from this blog

A simple calculator program.

→ A simple calculator using C language. In this, you can add, multiply, divide and subtract any two number. #include<stdio.h> int main() {    float a,b,c;    char d;    printf("Enter:");    scanf("%f  %c %f",&a,&d,&b);    if(d=='+')    {     c=a+b;     printf("%.2f",c);    }    else if(d=='-')    {     c=a-b;     printf("%.2f",c);    }    else if(d=='*')    {     c=a*b;     printf("%.2f",c);    }    else if(d=='/')    {     c=a/b;     printf("%.2f",c);    } } Output: Enter:  9/4              2.25