Found 26504 Articles for Server Side Programming

What are the different categories of functions in C Programming?

Sindhura Repala
Updated on 21-Jan-2025 16:13:15

31K+ Views

Functions are categorized bases on the presence or absences of arguments and whether they return a value. A user-defined function is one that is defined by the user when writing any program, as opposed to library functions that have predefined definitions. To meet specific requirements, the user must develop their own functions. Such functions must be properly defined by the user. A function is a block of code designed to perform a specific task. It is written once and can be reused multiple times as needed by the programmer. ... Read More

What are the different types of functions in C Programming?

Bhanu Priya
Updated on 09-Mar-2021 07:06:23

14K+ Views

Functions are broadly classified into two types which are as follows −predefined functionsuser defined functionsPredefined (or) library functionsThese functions are already defined in the system libraries.Programmer can reuse the existing code in the system libraries which is helpful to write error free code.User must be aware of syntax of the function.For instance, sqrt() function is available in math.h library and its usage is y= sqrt (x), where x= number must be positive.If x value is 25, i.e., y = sqrt (25) then ‘y’ = 5.In the same way, printf() is available in stdio.h library and clrscr() is available in conio.h ... Read More

How to write a C program to find the roots of a quadratic equation?

Bhanu Priya
Updated on 10-Dec-2024 13:10:44

153K+ Views

Problem Applying the software development method to solve any problem in C Language. Solution Find roots of a quadratic equation, ax2+bx+c. There will be 2 roots for given quadratic equation. Analysis Input − a, b, c values Output − r1, r2 values Procedure $r_{1}=\frac{-b+\sqrt{b^2-4ac}}{2a}$ $r_{2}=\frac{-b-\sqrt{b^2-4ac}}{2a}$ Design (Algorithm) Start Read a, b, c values Compute d = b2 4ac if d > 0 then ... Read More

Difference Between For and Foreach in PHP

AmitDiwan
Updated on 02-Mar-2021 05:08:19

5K+ Views

In this post, we will understand the differences between 'for' and 'foreach' loops in PHP −The 'for' loopIt is an iterative loop that repeats a set of code till a specified condition is reached. It is used to execute a set of code for a specific number of times. Here, the number of times is the iterator variable.Syntax:for( initialization; condition; increment/decrement ) {    // code to iterate and execute }Initialization: It is used to initialize the iterator variables. It also helps execute them one at a time without running the conditional statement at the beginning of the loop's condition.Condition: ... Read More

Difference Between Object and Class in C++

AmitDiwan
Updated on 02-Mar-2021 04:57:52

926 Views

In this post, we will understand the difference between an object and a class with respect to C++ programming language.Classes in C++It is a building block of code in C++ that helps implement object oriented programming.It is a type that is defined by the user.It holds its own data members and member functions.These data members and member functions can be accessed by creating an instance of the class.They can be used to manipulate the variables and can be used to define property to tell how the objects in a class have to act.It can be understood as a blueprint for ... Read More

Difference Between C# and C++

AmitDiwan
Updated on 02-Mar-2021 04:56:56

584 Views

Let us first learn about C# and C++ −C# is a general-purpose object-oriented programming language.It is considered as a pure object-oriented programming language.It is pronounced as 'C sharp'.It was developed by Anders Hejlsberg and his team at Microsoft.Memory Management is done automatically by the garbage collector.It is the language's duty to automatically delete the object once its objective is completed.It is windows specific, i.e. it can't be used on all systems.It doesn't support multiple inheritance.The pointers in C# can only be used in the unsafe mode.It is considered as a high-level language.Once the code is compiled, it gets converted into ... Read More

Python Pandas – How to use Pandas DataFrame tail( ) function

Vani Nalliappan
Updated on 27-May-2024 11:21:00

664 Views

Write a Python code to find price column value between 30000 to 70000 and print the id and product columns of the last three rows from the products.csv file. Result for price column value between 30000 to 70000 and id and product columns last three rows are −    id product 79 80 Truck 81 82 Bike 98 99 TruckSolution 1 Read data from products.csv file and assign to dfdf = pd.read_csv('products.csv ')Apply pandas slicing to access all rows of price column between 30000 to 50000 as, df[df.iloc[:, 4].between(30000, 50000)Save the above result to df1Apply slicing to access last ... Read More

Python Pandas – How to use Pandas DataFrame Property: shape

Vani Nalliappan
Updated on 29-Feb-2024 13:29:10

948 Views

Write a Python program to read data from the products.csv file and print the number of rows and columns. Then print the ‘product’ column value matches ‘Car’ for first ten rowsAssume, you have ‘products.csv’ file and the result for number of rows and columns and ‘product’ column value matches ‘Car’ for first ten rows are −Rows: 100 Columns: 8  id product engine avgmileage price height_mm width_mm productionYear 1 2  Car    Diesel    21      16500    1530    1735       2020 4 5  Car    Gas       18      17450    1530   ... Read More

Convert vowels from upper to lower or lower to upper using C program

Bhanu Priya
Updated on 24-Mar-2021 14:29:19

2K+ Views

An array of characters is called a string.DeclarationFollowing is the declaration for an array −char stringname [size];For example − char a[50]; string of length 50 charactersInitializationUsing single character constant −char a[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants −char a[10] = "Hello":;AccessingThere is a control string "%s" used for accessing the string till it encounters ‘\0’.The logic used to convert vowels from upper to lower or lower to upper is −for(i=0;string[i]!='\0';i++){    if(string[i]=='a'||string[i]=='e'||string[i]=='i'||string[i]=='o'||string[i]=='u'){       string[i]=toupper(string[i]);    } } printf("The result string with converted vowels is : "); puts(string);ProgramFollowing is the C program using conversion functions ... Read More

C Program to find the given number is strong or not

Sindhura Repala
Updated on 23-Jan-2025 10:53:45

42K+ Views

Recursive Factorial Calculation A strong number is a number, where the sum of the factorial of its digits equals the number itself. In C programming, a factorial is the product of all positive integers less than or equal to a given number. To calculate the factorial of a number, we use a recursive function with the argument N. This function will repeatedly call itself with a decremented value of N, multiplying the results until it reaches 1. 123!= 1!+2!+3!  =1+2+6 =9 In this case, 123 is not a strong number because the sum of the factorial of its digits ... Read More

Advertisements