Bhanu Priya has Published 1449 Articles

Example program on Dynamic memory allocation function in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:36:21

726 Views

ProblemHow to display and calculate the sum of n numbers by using dynamic memory allocation function in C language?SolutionFollowing is the C program to display the elements and calculate the sum of n numbers by the user by using dynamic memory allocation functions. Here, we also try to reduce the ... Read More

How to use ‘else if ladder’ conditional statement is C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:35:00

644 Views

Else − if the ladder is the most general way of writing a multi-way decision.The syntax for else if the ladder is as follows −if (condition1)    stmt1; else if (condition2)    stmt2;    - - - - -    - - - - -    else if (condition n) ... Read More

What are the shift operations in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:32:55

951 Views

ProblemWhat is the simple program to show the left, right shifts, and complement of a number by using C language?SolutionLeft ShiftIf the value of a variable is left-shifted one time, then its value gets doubled.For example, a = 10, then a1 = 5ExampleFollowing is the C program for the shift ... Read More

How to delete the vowels from a given string using C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:31:28

5K+ Views

The logic we use to implement to delete the vowels from the given string is as follows −for(i=0; i

How to use Pre-defined mathematical function in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:29:13

297 Views

ProblemHow to find the cube root of any given number by using the C programming language?SolutionAlgorithmStep 1: Enter any number at run time Step 2: Read from console Step 3: Compute result         Result:pow(number, 1.0/3.0) Step 4: Increment result Step 5: Print resultExampleFollowing is the C program ... Read More

What are the input and output for strings in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:27:24

5K+ Views

An array of characters (or) collection of characters is called a string.Input and output for stringsExampleFollowing is the C program for input and output for strings −#include main ( ){    char a[30];    printf("enter your name");    scanf ( "%s", a);    printf ("your name is %s", a);   ... Read More

What is a string? Declare and initialize the strings in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:26:10

7K+ Views

An array of characters (or) collection of characters is called a string.DeclarationRefer to the declaration given below −char stringname [size];For example - char a[50]; a string of length 50 characters.InitializationThe initialization is as follows −Using single character constant −char string[20] = { ‘H’, ‘i’, ‘l’, ‘l’, ‘s’ ,‘\0’}Using string constants ... Read More

C program to find Fibonacci series for a given number

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:23:36

2K+ Views

Fibonacci Series is a sequence of numbers obtained by adding the two previous numbers.Fibonacci series starts from two numbers f0 & f1.The initial values of fo & f1 can be taken 0, 1 or 1, 1 Fibonacci series satisfies the following conditions −fn = fn-1 + fn-2AlgorithmRefer to the algorithm ... Read More

How to count number of vowels and consonants in a string in C Language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:19:18

2K+ Views

ProblemHow to write a C program to count numbers of vowels and consonants in a given string?SolutionThe logic that we will write to implement the code to find vowels and consonants is −if(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == ... Read More

Structure declaration in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:15:03

13K+ Views

The structure is a collection of different datatype variables, grouped together under a single name. It is a heterogeneous collection of data items that share a common name.Features of structureIt is possible to copy the contents of all structural elements of different data types to another structure variable of its ... Read More

Advertisements