What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2021-09-14 15:36:04
Sum of digits of a number using recursion function c
/* * C Program to find Sum of Digits of a Number using Recursion */ #include <stdio.h> int sum (int a); int main() { int num, result; printf("Enter the number: "); scanf("%d", &num); r... Add solution -
C++ 2021-09-14 04:31:02
private and public in namespace cpp
#include <cstdio> #include "thing.hpp" int main(int argc, char **argv) { printf("%d\n", thing::getX()); // OK printf("%d\n", thing::getSum()); // OK printf("%d\n", thing::sum(1, 2)); // err... Add solution -
PHP 2021-09-13 20:49:03
php sprintf
There are already some comments on using sprintf to force leading leading zeros but the examples only include integers. I needed leading zeros on floating point numbers and was surprised that it didn't work as expected. Example: <?php sprintf('%02d',... Add solution -
Go 2021-09-13 13:39:03
extract value from interface in golang
// extracts interface value to known string type. func extractValueFromInterface(value interface{}) { str, ok := value.(string) if ok { fmt.Printf("string value is: %q\n", str) } else { fmt.Printf("value is not a string: %v\n", ... Add solution -
C 2021-09-13 11:51:03
multiplication table in c
#include <stdio.h> int main(){ //declaring variables int n,i,a,start,end; //taking and printing the instructions printf("Enter first number from where you want to start multiplication : \n"); scanf("%d",&sta... Add solution -
C 2021-09-13 08:38:04
c program for prims algorithm
#include<stdio.h> #include<conio.h> int a,b,u,v,n,i,j,ne=1; int visited[10]= { 0},min,mincost=0,cost[10][10]; void main() { clrscr(); printf("\n Enter the number of nodes:"); scanf("%d",&n); printf("\n Enter th... Add solution