24 Computer -- Programming Concepts and Logics

ask mattrab Visit www.askmattrab.com for more academic resources.

C Program to find sum of two numbers

C Program to find sum of two numbers

#include<stdio.h>

int main()

{

   int a, b, sum;

   printf("\nEnter two no: ");

   scanf("%d %d", &a, &b);

   sum = a + b;

   printf("Sum : %d", sum);

   return(0);

}


Output :

Enter two no: 5 6

Sum : 11

Discussions

Aayush Bhattarai asked almost 4 years ago

what does \n and %d mean?

Raunak Kumar answered almost 4 years ago

Here, in C programming \n is an escape character that helps to create a new line whereas %d is a format specifier that allows to specify only Integer values.

More notes on Programming Concepts and Logics

Close Open App