In this tutorial learn how you can get three numbers from the user and add three numbers. First, we will ask the user for the numbers and then add those numbers.
C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.
Write a Program to Add Three Numbers. Get Numbers from the User
Here is the code to add three numbers. Get numbers from the user in C programming.
#include <stdio.h> //WAP to add three numbers. Get numbers from the user. int main(){ int first_number,second_number,third_number,sum; printf("Please enter the first number:"); scanf("%d",&first_number); //Get first number from user printf("Please enter the second number:"); scanf("%d",&second_number); //Get second number from user printf("Please enter the third number:"); scanf("%d",&third_number); //Get third number from user sum = first_number+second_number+third_number; printf("The total sum is:%d",sum); //Displays sum return 0; }
Test Live At Jdoodle
Conclusion
This is how you can get numbers from the user and add three numbers in c programming. Comment below if you like our tutorial.