Loading...

Sum of Two Numbers C Program


C Program which takes input of two number and print their sum.





You can also do this by an easy method Like this:

#include <stdio.h>
main()
{
int a,b;

    printf("Enter two numbers: ");
    scanf("%d %d",&a,&b);

    printf("Sum is %d",a+b);
}

Also by making Function of Sum:

#include <stdio.h>
int sum(int,int);
main()
{
    int a,b,c;

    printf("Enter two numbers: ");
    scanf("%d %d",&a,&b);

    c=sum(a,b);

    printf("Sum is %d",c);
}
int sum(int a,int b)
{
    return a+b;

}
Rate this posting:
{[['']]}

0 comments:

Post a Comment

 
TOP