C program to print all uppercase and lowercase letters in the alphabet

In this example program, we will learn how to print the uppercase and lowercase letters in C programming language in 3 different ways. We will use a while loop, for loop and do...while loop to write the program.

Read

C program to print a diamond pattern using star or any character

In this tutorial, we will learn how to print the diamond star pattern using C programming language. User will give the input for number of rows of the star pattern and we will print out the result. For rows count 5, it will print like below :.

Read

C program to copy one string to another

In this C programming tutorial , we will learn how to copy a string using a built-in library function. The library function we are going to use is char *strcpy(char *dest, const char *src) . We will pass two variables to this function - dest and src. All the contents of src will be copied to dest. Let's take a look into the program first :.

Read

C program to find the sum of 'n' numbers using dynamic memory allocation

In this tutorial, we will learn how to find the sum of 'n' numbers by allocating memory dynamically. We will learn three different ways, by using a for loop, a while loop and with a do-while loop. You will learn how to use the malloc() and free() methods with examples.

Read

C program to print pyramid using star or any other character

In this tutorial, we will learn how to print a pyramid using star '*' or any other character using 'C programming language'. The user will input the height of the pyramid and we will print the pyramid equal to that height . It will look like as below :.

Read

Java program to replace string in a file

In this tutorial, we will learn how to read strings from a file, how to modify the contents and then again write them back in the same file. We are not taking any inputs from the user. In this example, after reading the contents of the file, we are replacing all 'new' words with 'old'. For example, if the file contain one string This is a new ball., after modification it will become This is a old ball. Let's take a look into the program before moving into more details :.

Read

Write a C program to calculate profit or loss

In this tutorial, we will learn how to find the profit or loss . We will get the cost price and selling price from the user and store it in different variables. And next, we will check if the user had made a profit or loss by finding the difference between cost price and selling price - selling price - cost price. If the value is more than 0, means selling price is more than cost price , so the user has made a profit. Else, loss. We will also print out the value of the loss or profit.

Read

Java program to convert a string to boolean

In this example, we will learn how to convert a string to boolean value. For that, we will use one static method valueOf(String) of the Boolean class. This class is defined as below :.

Read

Java program to capitalize first letter of each word in a string

In this tutorial, we will learn how to capitalize first letter of each word in a string in Java. User will input one string and then we will capitalize first letter of each word and modify and save the string in a different String variable. Finally, we will output the String.

Read

C program to add two numbers using their addresses

In this tutorial, we will learn how to add two numbers using addresses in C programming language. Mainly we will learn how to access the values of one address in C. Let's take a look into the algorithm first :.

Read