Bhanu Priya has Published 1060 Articles

Write a C program using time.h library function

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 16:33:29

403 Views

ProblemHow to display the current date and time in ISO standard format using C Programming language?SolutionThe current date and time of the input will be taken and we are trying to print the system time and date in ISO format.For example, Monday, Dec 15, 2020 10.50p.The built-in functions that we ... Read More

Calculate interest amount by using formula in C language

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 16:17:24

948 Views

ProblemWrite a C program to calculate the deposited amount incremented after some years with interestSolutionThe formula for calculating interest is −M=((r/100) * t); A=P*exp(M);Where r= rate of interest            t=no. of years            P=amount to be deposited            ... Read More

Write a C program to demonstrate post increment and pre increment operators

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 08:02:49

3K+ Views

Increment operator (++)It is used to increment the value of a variable by 1. There are two types of increment operators, pre-increment and post-increment.The increment operator is placed before the operand in pre-increment and the value is first incremented and then the operation is performed on it.For example, z = ... Read More

Write C program using isupper() function

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:59:15

249 Views

ProblemHow to identify a total number of upper-case alphabets in a string using C Programming?SolutionThe logic we used to count number of upper-case letters in a sentence is as follows −for(a=string[0];a!='\0';i++){    a=string[i];    if (isupper(a)){       counter=counter+1;       //counter++;    } }Example 1 Live Demo#include #include ... Read More

Write a C program to check the atexit() function

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:52:09

589 Views

The atexit() is a function that allows the user to register a function that has to be called based on program termination.It is a predefined function that is included in stdlib header files.Example 1 Live Demo#include #include void welcome(void){    printf("Welcome to New, "); } void world(void){    printf("World"); } int ... Read More

Explain the functions fread() and fwrite() used in files in C

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:46:28

24K+ Views

ProblemWrite a C program for storing the details of 5 students into a file and print the same using fread() and fwrite()SolutionThe fread() function reads the entire record at a time.Syntaxfread( & structure variable, size of (structure variable), no of records, file pointer);Examplestruct emp{    int eno;    char ename ... Read More

Concatenating n characters from source string to destination string in C

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:44:01

885 Views

ProblemWrite a C program to concatenate n characters from source string to destination string using strncat library functionSolutionThe strcat functionThis function is used for combining or concatenating two strings.The length of the destination string must be greater than the source string.The resultant concatenated string will be in the source string.Syntaxstrcat ... Read More

Write a C program to read a data from file and display

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:36:39

17K+ Views

ProblemHow to read a series of items that are present in a file and display the data in columns or tabular form using C ProgrammingSolutionCreate a file in write mode and write some series of information in the file and close it again open and display the series of data ... Read More

Write a C program to display the size and offset of structure members

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:10:26

1K+ Views

ProblemWrite a C program to define the structure and display the size and offsets of member variablesStructure − It is a collection of different datatype variables, grouped together under a single name.General form of structure declarationdatatype member1; struct tagname{    datatype member2;    datatype member n; };Here, struct  - keywordtagname ... Read More

Legal and illegal declaration and initializations in C

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:02:53

2K+ Views

ProblemMention some of the legal and illegal declarations and initializations while doing C programming?Before discussing the legal and illegal statements let’s see how to declare and initialize the variables in C.Variable declarationFollowing is the syntax of variable declaration −SyntaxDatatype v1, v2, … vn;Where v1, v2, ...vn are names of the ... Read More

Advertisements