GithubHelp home page GithubHelp logo

datastructuresstudies's Introduction

Buy Me A Coffee
wakatime

Projects

Project Name Technologies Used Links
NextJS w/App Router Starter - NextJS w/App Router
- NextAuth
- TypeScript
- Prettier
- Eslint
- Husky
- SwaggerUI
- Supabase
- Prisma ORM
- TailwindCSS
- Vercel
πŸ“¦ Repo
🌐 Website
Advertisement App - NextJS w/App Router
- CSS Modules & SASS
- TypeScript
- Prisma
- Docker
- PostgreSQL
- Cloudinary
- React Hook Forms
- Yup
- Supabase
- Context API
- Tanstack Query (see: πŸŽ‹branch)
- Local Storage
- Vercel
πŸ“¦ Repo
🌐 Website
Karsal - NextJS
- TypeScript
- MongoDB
- i18n localization router
- SASS Modules
- React Responsive
- Vercel
πŸ“¦ Repo
🌐 Website
Source Pocket - Docusaurus v2
- ReactJS
- Algolia
- MDX
- Netlify
πŸ“¦ Repo
🌐 Website
connEth - NextJS
- TypeScript
- TailwindCSS
- Moralis
- Prisma
- MetaMask
- Husky
- Lint Staged
- HeadlessUI
- Vercel
πŸ“¦ Repo
Damla KΓΆksal
Personal Website
- GatsbyJS
- MDX
- Vercel
πŸ“¦ Repo
🌐 Website
Clou Shopify 🌐 Website

datastructuresstudies's People

datastructuresstudies's Issues

Recursion - Zero Problem


import java.util.Scanner;

public class FindingDigitsExample {
	
	public static int digit=0; //Digit has to be static and at the outside of the findDigit method.
	
	public static int findDigit(int number) { //Recursive functions can not have void.	

			if(number!= 0) {
				digit++;
				return findDigit(number/10);
			}
		
			else if(number == 0) {		
				return digit;
			}
		
			else //for invalid conditions it returns 1.
				return 1; 
		}
	
	public static void main(String[]args) {
		
		Scanner sc=new Scanner(System.in);
		System.out.print("Enter the number: ");
		int a=sc.nextInt();
		
		if(a==0) {
			System.out.println(1);
		}
		
		else {
			int b=findDigit(a);
			System.out.print(b);
		}
		sc.close();
	}
}

This version of code calculates digit number of zero as zero.

Recursion


public class FindingDigitsExample {

	public static int findDigit(int number) { //Recursive functions can not have void.
		
		int digit=0;
		
		if(number!= 0) {
			digit++;
			return findDigit(number/10);
		}
		
		else {		
			return digit;
		}
	}
	
	public static void main(String[]args) {
		
		int a=findDigit(124); 
		System.out.println(a);
		
	}
}
  • When the main method run, it always gives zero.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.