factorial in c++
C++
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int fact(int i){
if (i <= 1) return 1;
else return i*fact(i-1);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
cout << fact(N) << "\n";
return 0;
}
Also in C++:
- Title
- : error: ‘cont’ cannot be used as a function return (cont(cont-1))/2;
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- c++ give options
- Category
- C++
- Title
- vectors in c++ geeksforgeeks
- Category
- C++
- Title
- c++ argv
- Category
- C++
- Title
- for loop
- Category
- C++
- Title
- c++ class member initialization
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- c++ files
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- Read multiple files(.txt) c++
- Category
- C++
- Title
- c++ create object
- Category
- C++
- Title
- length of string in c++
- Category
- C++
- Title
- get elements of 2d array c++
- Category
- C++
- Title
- array<string, 7> c++
- Category
- C++
- Title
- range based for loop c++ with reference
- Category
- C++
- Title
- How to read a file in in C++
- Category
- C++
- Title
- how to create object in c++
- Category
- C++
- Title
- type id c++
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- c++ function return array
- Category
- C++
- Title
- c++ throw exception
- Category
- C++
- Title
- c++ template function
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- how to compare two strings lexicographically in c++
- Category
- C++
- Title
- cpp how to create an object of template class
- Category
- C++
- Title
- c++ replace n substrings
- Category
- C++
- Title
- min coin change problem dp
- Category
- C++
- Title
- how to compare lower case character to uppercase cpp
- Category
- C++
- Title
- c++ char if
- Category
- C++
- Title
- memset c++
- Category
- C++
- Title
- c++ loop through int array
- Category
- C++
- Title
- getch c++ library
- Category
- C++
- Title
- c++ crash windows
- Category
- C++
- Title
- c++ vector pop_back
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- pause the console c++
- Category
- C++
- Title
- pointers in cpp
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- c++ cout int
- Category
- C++
- Title
- c++ triple
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- c++ function to find length of array
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- c++ push multiple elements to vector
- Category
- C++
- Title
- how to get input from the console in c++
- Category
- C++
- Title
- how to run a c++ program in the background
- Category
- C++
- Title
- what is iterator in c++?
- Category
- C++
- Title
- c++ scanf
- Category
- C++
- Title
- nan c++ example
- Category
- C++
- Title
- how to declare a function in c++
- Category
- C++
- Title
- c++ declare variable
- Category
- C++
- Title
- c++ string to vector int
- Category
- C++
- Title
- split 2d array into chunks in c++
- Category
- C++
- Title
- Combination Sum
- Category
- C++
- Title
- E/flutter (20384): [ERROR:flutter/third_party/txt/src/minikin/FontFamily.cpp(184)] Could not get cmap table size! E/flutter (20384): F/flutter (20384): [FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0
- Category
- C++
- Title
- lambda operator in c++
- Category
- C++
- Title
- list conda environments
- Category
- C++
- Title
- making random numbers in c++
- Category
- C++
- Title
- create a 2d array c++
- Category
- C++
- Title
- c++ reset stream
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- memcmp in cpp
- Category
- C++
- Title
- never gonna give you up
- Category
- C++
- Title
- c++ program to find gcd of 3 numbers
- Category
- C++
- Title
- c++ while true loop
- Category
- C++
- Title
- copy a part of a vector in another in c++
- Category
- C++
- Title
- how to find the size of a character array in c++
- Category
- C++
- Title
- substr in c++
- Category
- C++
- Title
- newline in c++
- Category
- C++
- Title
- How to find the kth smallest number in cinstant space
- Category
- C++
- Title
- delete files c++
- Category
- C++
- Title
- c++ string^ to char*
- Category
- C++
- Title
- msdn parse command line
- Category
- C++
- Title
- c++ comment
- Category
- C++
- Title
- passing a vector to a function c++
- Category
- C++
- Title
- lisy stl C++
- Category
- C++
- Title
- c++ vector add element
- Category
- C++
- Title
- initialise 2d vector in c++
- Category
- C++
- Title
- c++ menu selection with arrow keys
- Category
- C++
- Title
- how to format decimal palces in c++
- Category
- C++
- Title
- ceil in c++
- Category
- C++
- Title
- create copy of range of string c++
- Category
- C++
- Title
- case label in c++
- Category
- C++
- Title
- input a string in c++
- Category
- C++
- Title
- how to get the largest number in a c++ array
- Category
- C++
- Title
- c++ loop trhought object
- Category
- C++
- Title
- char size length c++
- Category
- C++
- Title
- how to convert qt string to string
- Category
- C++
- Title
- variadic templates
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- findung the mode in c++
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- c++ how to make a negative float positive
- Category
- C++
- Title
- cs1955 unity vector3
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- count function c++
- Category
- C++
- Title
- file format not recognized treating as linker script c++
- Category
- C++