eemonislame.work.gd
Open in
urlscan Pro
185.199.110.153
Public Scan
URL:
https://eemonislame.work.gd/
Submission: On November 25 via api from US — Scanned from CA
Submission: On November 25 via api from US — Scanned from CA
Form analysis
0 forms found in the DOMText Content
☰ MASTER C PROGRAMMING Learn C with comprehensive tutorials and examples × CONTENTS * Home * Introduction * Basics * Syntax * Variables * Data Types * Control Structures * If-Else * Loops * Functions * Function Declaration * Recursion * Advanced Topics * Pointers * Memory Management * About Us WELCOME TO C PROGRAMMING C is a powerful general-purpose programming language. It is fast, portable, and available on all platforms. This tutorial will guide you through the basics of C and help you master advanced topics with examples and explanations.Start your C journey by understanding basic syntax, followed by exploring functions, loops, arrays, and pointers! LATEST VLOGS & NEWS VLOG 1: INTRODUCTION TO C In this vlog, we explore the basics of C programming and why it’s such a powerful language for beginners and experts alike. VLOG 2: CONTROL STRUCTURES Learn about loops and conditionals in C programming in this easy-to-follow tutorial, suitable for all levels. NEWS: C PROGRAMMING IN 2024 Find out how C is still relevant in 2024, and the impact it’s having on systems programming and embedded development. BASICS Let's start with the basic structure of a C programme. Link Section Includes Files Declaration Section Declare Global Variables and Constants main() Function Section { Declaration part Execution part } Contains Variables Inputs And Outputs A example code will help you understand better. #include <stdio.h> int main() { printf("Hello, World!"); return 0; } EXPLANATION: #include <stdio.h> This file allow us to take Inputs and get Outputs. int main() It starts the main programme. printf("Hello, World!"); Displays output. return 0; Ends the programme. The output of the above programme will be like this on the compiler. Hello, World! To write and run c programme you can use compilers like Codeblocks or Visual Studio Code. For the examples we will useVisual Studio code. For a new programme , we have to open the Visual Studio code>File>New>(file_name.c). Make sure to use the .c extension at the end, otherwise the code won't work. opening new file in visual studio code INPUTS AND OUTPUTS scanf("format specifier"); Used for taking inputs. printf("output"); Used for getting Outputs. Now let's try an example. TAKING INPUT AND GETTING OUTPUT: #include<stdio.h> int main() { int a; scanf("%d", &a); printf("%d", a); return 0; } EXPLANATION: Here we used a as a variable, Variables are used to assign different kind of data. we used the variable a as integer with int , integer refers the data is a natural number which is contained by the variable. Now the scanf("%d", &a);takes the value of the variable a from the user And then printf("%d", a); displays the number/value of a as Output. BASIC CALCULATIONS As we learned how to take inputs and how to get outputs, now we will try some basic calculations with the variables like summation, multiplication and dividing. SUM: To find the sum of two or more numbers, we have to use the plus(+)sign.And like this easy, we can find the sum of 7 and 5. Here's the code.. #include<stdio.h> int main() { int sum; sum = 7+5; printf("Result=%d",sum); return 0; } We can see the answer in the output. 12 We can even calculate any numbers using variables, here's an example with variables. #include<stdio.h> int main() { double a, b, p; printf("Enter two numbers:"); scanf("%lf %lf", &a, &b); product = a * b; printf("Product=%.2lf", p); return 0; } We used a and b as variables to store the value and multiply using the sign (*) and store the result in p. we used %.2lf to display 2 numbers after the decimal point. For example: a = 4.56 b = 8.91 then, Product= 13.47 CONDITIONAL STATEMENT In C programming, conditional statements are used to perform different actions based on certain conditions. The main types include: * If statement: Executes a block of code if a condition is true. * Else statement: Executes an alternative block if the if condition is false. * Else if ladder: Tests multiple conditions sequentially. * Switch statement: Evaluates a variable and executes code blocks based on its value, typically used for multiple fixed cases. These help control the program's flow based on logical conditions. Now let's see an example to find whether a number is even or odd. #include<stdio.h> int main() { int num; printf("Enter an integer: "); scanf("%d", &num); if (num % 2 == 0) printf("%d is even.", num); else printf("%d is odd.", num); return 0; } We can write the code in the Visual studio code, to see the result. This is how the code looks like in the Visual Studio Code. If the numbers is divided by 2 means the remainder is 0, num % 2 == 0 checks if the remainder is 0 or not. If it's 0 the number is even, otherwise it's odd. FIND THE LARGEST/SMALLEST NUMBER We can find the largest or the smallest number using the conditional operators. #include<stdio.h> int main() { double n1, n2, n3; printf("Enter 3 numbers:"); scanf("%lf %lf %lf",&n1,&n2,&n3); if (n1 >= n2 && n1 >= n3) printf("Largest=%.2lf",n1); else if (n2 >= n1 && n2 >= n3) printf("Largest= %.2lf", n2); else printf("Largest= %.2lf ", n3); return 0; } EXPLANATION 1. The program takes three double-precision numbers (n1, n2, and n3) as input from the user. 2. It uses a series of if and else if conditions to determine which of the three numbers is the largest. 3. The condition (n1 >= n2 && n1 >= n3) checks if n1 is greater than or equal to both n2 and n3, while similar checks are made for n2 and n3 in subsequent conditions. 4. The largest number is printed with two decimal places using the printf function. ABOUT US Your go-to platform for mastering C Programming! CONTACT Email: support@ctutorials.com FOLLOW US Facebook | Twitter | GitHub © 2024 C Programming Tutorials. All Rights Reserved.