Skip to main content

lldiv() , A function of library lldiv_t in c++

 

lldiv() Return value

The lldiv() function returns a structure of type lldiv_t which consists of two members: quot and rem. It is defined as follows:

struct lldiv_t {
	long long quot;
	long long rem;
};

Example: How lldiv() function works in C++?

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
	long long nume = 998102910012LL;
	long long deno = 415LL;
	
	lldiv_t result = lldiv(nume, deno);
	
	cout << "Quotient of " << nume << "/" << deno << " = " << result.quot << endl;
	cout << "Remainder of " << nume << "/" << deno << " = " << result.rem << endl;
	
	return 0;
}

When you run the program, the output will be:

Quotient of 998102910012/415 = 2405067253
Remainder of 998102910012/415 = 17

Comments

Popular posts from this blog

Service install on window system

 If we have to install service make sure,  .interframework install already. Goto folder like:-  C:\Windows\Microsoft.NET\Framework\v2.0.50727  C:\Windows\Microsoft.NET\Framework\ v2.0.50727 (Note: version folder can be change as the version change.) Open command prompt by  writing the "cmd" in the box of file/folder location shoes Run the command : "installUtil.exe pathofexeofthe service"

Program to find the number of 1's bit in a number

#include <bits/stdc++.h> using namespace std ; // this is the program to find the number of 1's bit in a number int count1nsBit ( int n ) {     int count = 0 ;     while ( n )     {         n = n & n - 1 ;         count ++ ;     }     return count ; } int main () {     int n ;     cin >> n ;     cout << count1nsBit ( n );     return 0 ; } /* input an output tast are comments */

Type of Graph

  Depending upon the position of the vertices and edges, the Graphs can be classified into different types: Null Graph:  A Graph with an empty set of edges is termed a Null Graph. Trivial Graph:  A Graph having only one vertex is termed a Trivial Graph. Simple Graph:  A Graph with neither self-loops nor multiple edges is known as a Simple Graph. Multi Graph:  A Graph is said to be Multi if it consists of multiple edges but no self-loops. Pseudo Graph:  A Graph with self-loops and multiple edges is termed a Pseudo Graph. Non-Directed Graph:  A Graph consisting of non-directed edges is known as a Non-Directed Graph. Directed Graph:  A Graph consisting of the directed edges between the vertices is known as a Directed Graph. Connected Graph:  A Graph with at least a single path between every pair of vertices is termed a Connected Graph. Disconnected Graph:  A Graph where there does not exist any path between at least one pair of vertices is ...