+ 1

Basic about C language

Q. Variables and rules of variables declaration. Q. Write Simple C Program to add two number using constant and variables. Q. Write Simple C Program to add two number taking input from user.

6th Jan 2024, 8:00 AM
Faiz Naik
Faiz Naik - avatar
3 ответов
+ 3
Is this your homework? What do you expect from this thread? If you need help, link your code attempt and describe the issue. If you want us to do your homework for you: NO.
6th Jan 2024, 8:15 AM
Lisa
Lisa - avatar
+ 2
Sure, let's cover some basics and provide examples for your questions: ### 1. Variables and Rules of Variable Declaration in C: In C, variables are used to store data. Here are some rules for declaring variables: - Variable names must begin with a letter or underscore. - Following characters can be letters, digits, or underscores. - Variable names are case-sensitive. - Keywords cannot be used as variable names. - White spaces are not allowed in variable names. ### 2. Simple C Program to Add Two Numbers using Constants and Variables: ```c #include <stdio.h> int main() { // Variables declaration int num1, num2, sum; // Assign values num1 = 10; num2 = 20; // Addition sum = num1 + num2; // Print the result printf("Sum: %d\n", sum); return 0; } ``` ### 3. Simple C Program to Add Two Numbers Taking Input from the User: ```c #include <stdio.h> int main() { // Variables declaration int num1, num2, sum; // Input from user printf("Enter first number:
8th Jan 2024, 2:28 AM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
+ 1
Please check the first few lessons of the Sololearn C course, you will find your answers. https://www.sololearn.com/learn/courses/c-introduction
6th Jan 2024, 8:40 AM
Tibor Santa
Tibor Santa - avatar