Found 26504 Articles for Server Side Programming

C program for testing the character type

Bhanu Priya
Updated on 26-Mar-2021 07:33:20

1K+ Views

There are some predefined functions available in "ctype.h" library for analyzing the character input and converting them.Analysis FunctionsThe character analysis functions are listed below −FunctionChecks whether entered character isisalphaAn alphabet (or) notisdigitA digit (or) notisspace QA space, a newline (or) tabispunct (A special symbol (or) notislowerA lower case letter of alphabetisupper QAn upper case letter of alphabetisalphanumericAn alphabet/digit or notConverting FunctionsThe converting functions are listed below −FunctionConversiontolower()Converts an upper case alphabet to lower casetoupper QConverts a lower case alphabet to upper caseProgramFollowing is the C program for character analysis and conversion functions which are used to test the character type ... Read More

C program to convert days into months and number of days

Bhanu Priya
Updated on 26-Mar-2021 07:31:10

13K+ Views

User has to enter total number of days. We need to convert the total number of days into months and left-over days in coming month.The formula to convert days into months is as follows −          Month=days/30The logic to find left-over days for the coming month is as follows −          Days=days %30AlgorithmRefer an algorithm given below to convert days into months and number of days.Step 1: Start Step 2: Declare month and days Step 3: Read total number of days Step 4: Compute months    months=days/30 Step 5: Compute days    Days= days ... Read More

Explain important functions in math.h library functions using C language

Bhanu Priya
Updated on 26-Mar-2021 07:30:48

622 Views

All mathematical related functions are stored in math.h header file in C programming language. The functions are explained below in detail.sin()This function is used to find the sin value of its argument.The syntax of sin() function is as follows −double sin(double a);For example, double a=sin(3.14/2);The output is as follows −a=1 (approx.)cos()It is used to find the cos value of its argument.The syntax for cos() function is as follows −double cos(double a); For example, double a=cos(3.14/2);The output is as follows −a=0 (approx.)tan()It is used to find the tan value of its argument.The syntax for tan() function is as follows −double tan ... Read More

Explain the concept of one and two dimensional array processing using C language

Bhanu Priya
Updated on 26-Mar-2021 07:25:25

570 Views

Let us first understand the one dimensional array processing in C programming language.1D Array ProcessingStoring values in 1 D Array(reading) is done as follows −int num[5] int i; for(i=0;i

C Program to check the type of character entered

Bhanu Priya
Updated on 26-Mar-2021 07:32:19

8K+ Views

Write a program to find out that a given character is upper case, lower case, number or special character.SolutionIf an entered character is capital letter then, it displays the upper case.Example: Input =H Output: upper case letterIf an entered character is small letter then, it displays the lower case letter.Example: Input= g Output: lower case letterIf an entered character is number then, it displays the digit.Example: Input=3 Output: digitIf an entered character is a special character then, it displays the special character.Example: Input= & Output: special characterAlgorithmRefer an algorithm given below to find out that a given character is upper ... Read More

C program to find in which quadrant the coordinates lie.

Bhanu Priya
Updated on 26-Mar-2021 07:25:34

1K+ Views

ProblemWrite a program to find the quadrant in which the given coordinates lie.User has to enter a coordinate at runtime and we need to find the quadrant in which these coordinates lie.SolutionIf both numbers are positive then, it displays the first quadrant.Example: Input =2, 3 Output = 1st quadrantIf the first number is negative and the second number is positive then, it displays the second quadrant.Example: Input = -4, 3 Output= 2nd quadrantIf the first number is negative and the second number is also negative then, it displays the third quadrant.Example: Input = -5, -7 Output= 3rd quadrantIf the first ... Read More

C program to remove the brackets from a given input.

Bhanu Priya
Updated on 26-Mar-2021 07:18:28

855 Views

ProblemLet’s create a simplified expression by removing brackets from the expressions.SolutionExample 1Input: A string expression with bracket is as follows: (x+y)+(z+q) The output is as follows: x+y+z+qExample 2The input is as follows: (x-y+z)-p+q The output is as follows: x-y+z-p+qAlgorithmRefer an algorithm to remove the brackets from a given input.Step 1: Declare and read the input at runtime.Step 2: Traverse the string.Step 3: Copy each element of the input string into new string.Step 4: If anyone parenthesis is encountered as an element, replace it with empty space.ExampleFollowing is the C program to remove the brackets from a given input −#include int ... Read More

C program to search an array element using Pointers.

Bhanu Priya
Updated on 26-Mar-2021 07:14:58

15K+ Views

ProblemWrite a C program to search an element from an array at runtime by the user and the result to be displayed on the screen after search. If the searching element is not in an array then, we need to search element is not found.SolutionAn array is used to hold the group of common elements under one nameThe array operations are as follows −InsertDeleteSearchAlgorithmRefer an algorithm to search the elements into an array with the help of pointers −Step 1 − Declare and read the number of elements.Step 2 − Declare and read the array size at runtime.Step 3 − ... Read More

Explain unformatted input and output functions in C language

Sindhura Repala
Updated on 21-Jan-2025 15:58:29

8K+ Views

Unformatted input and output functions read a single input sent by the user and permit the display of the value as the output at the console. Unformatted input functions The unformatted input functions in the C programming language are used only for character data type or character string/array and cannot be used for any other datatype. These functions are used to read a single input from the user and this allows the user to display the value at the console. The getchar() Function This getchar() function reads only the first single character from the given keyboard that multiplies characters is typed ... Read More

Find the largest number in a series by using pointers in C language

Sindhura Repala
Updated on 20-Jan-2025 17:21:54

4K+ Views

A pointer is a variable that stores the address of another variable. We can hold the null values by using pointer. It can be accessed by using pass by reference. Also, there is no need of initialization, while declaring the variable. Instead of holding a value directly, it holds the address where the value is stored in memory. The two main operators used with pointers are the dereferencing operator and the address operator. These operators are used to declare pointer variables and access the values stored at those address. Pointer variable uses the dereferencing operator to access the value it ... Read More

Advertisements