Your Search Results

100 results found for ""

    Codes (89)
    • Java program to check Prime Number | AskTheCode

      Java program to check whether a number is Prime or not | Java programming | AskTheCode Problem: Write a Java program that finds the prime numbers between 2 and 500. Your program should stop if we entered a number less than 2. Input: A line that contains a number N. Output: Line containing whether the number is Prime Number or not. Example: Enter the number to check whether it's prime or not: 55 55 is not a Prime Number. Enter the number to check whether its prime or not: 5 5 is a Prime Number. Enter the number to check whether its prime or not: 1 Code: import java.util.Scanner; public class PrimeNumber{ public static boolean checkPrime(int n){ boolean isPrime=true; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { isPrime = false; break; } } if (n<2) isPrime = false; return isPrime; } public static void main(String[] args) { Scanner sc = new Scanner(; System.out.print("Enter the number to check whether it's prime or not: "); int n = sc.nextInt(); do{ boolean isPrime = checkPrime(n); if (isPrime == true) System.out.println(n+" is a Prime Number."); else System.out.println(n+" is not a Prime Number."); System.out.print("Enter the number to check whether its prime or not: "); n = sc.nextInt(); }while (n >= 2); } }

    • Determine the salary for several employees using Java | AskTheCode

      Java program to calculate the employee's salary | Java programming solution | AskTheCode Problem: Write a Java program that will determine the salary for each of several employees. The company pays "straight-time" for the first 40 hours, if the employee worked more than 40 hours, we consider the extra hours as overtime and the employee gets 50 % extra for each overtime hour. You are given each employee's number of worked hours and hourly rate. Your program should input this info(worked hours and hourly rate) for each employee then it should determine and display the employee's salary. The program will stop if we enter -1. Input: First line contains worked hours. Next line contains hourly rate. Output: Single line containing the employee's salary. Example: Enter hours worked (-1 to end): 39 Enter hourly rate of the worker ($00.00): 10.00 Salary is 390.0 Enter hours worked (-1 to end): 41 Enter hourly rate of the worker ($00.00): 10.00 Salary is 415.0 Enter hours worked (-1 to end): -1 Code: import java.util.Scanner; public class CalcEmployeeSalary{ public static double calcSalary(int n, double hourlyrate){ int extraTime = 0; /* If worked hour is more than 40, then obtain the extra hour */ if (n > 40) extraTime = n - 40; n = n - extraTime; double salary = (n * hourlyrate) + ((1.5 * hourlyrate) * extraTime); return salary; } public static void main(String[] args) { Scanner sc = new Scanner(; System.out.print("Enter hours worked (-1 to end): "); int n = sc.nextInt(); do{ System.out.print("Enter hourly rate of the worker ($00.00): "); double rate = sc.nextDouble(); System.out.println("Salary is "+calcSalary(n, rate)); System.out.print("\nEnter hours worked (-1 to end): "); n = sc.nextInt(); }while (n != -1); } }

    • Calculate BMI in Java | AskTheCode

      Java program to calculate BMI and also interpret it | Java programming solution | Ask The Code Problem: Write a Java program that reads values for weight in kilograms and height in centimeters and prints out the BMI ( Body Mass Index). Your program should also print on screen an interpretation of the BMI. Use the following scale: Input: A Line contains weight (in kg) and height (in cm) separated by a space. Output: The first line displaying BMI up to 2 decimal points. Next line displaying the interpretation of the BMI according to the provided scale. Code: import java.util.*; public class BMI_Calculator{ /* Function for converting kg to pounds */ public static double kilogramToPound(double kilogram){ double pounds = kilogram * 2.2; return pounds; } /* Function for converting cm to inches */ public static double centimetresToInches(double centimetres){ double inches = centimetres * 0.39; return inches; } /* Function for calculating BMI */ public static double bmi_calc(double weight, double height){ double bmi = (weight * 703) / (height * height); return bmi; } public static void main(String []args){ Scanner sc = new Scanner(; System.out.println("Enter your weight (in kg) and height (in cm) separated by a space: "); String s = sc.nextLine(); s = s.trim(); double height = Double.valueOf(s.substring(s.indexOf(" ")+1,s.length())); double weight = Double.valueOf(s.substring(0,s.indexOf(" "))); weight = kilogramToPound(weight); height = centimetresToInches(height); double bmi = bmi_calc(weight, height); System.out.printf("%.2f",bmi); System.out.println(); if (bmi >= 15 && bmi < 19) System.out.println("Underweight"); else if (bmi < 25) System.out.println("Normal"); else if (bmi < 30) System.out.println("Overweight"); } }

    View All
    ATC Journa (11)
    • Amazing Programs - ATC Journal | AskTheCode

      ATC Journal Home Raise A Query Coding Solutions ATC Journal ATC Community About ATC More... Log in / Sign up Simple Python program to download YouTube videos Note: The program that we are sharing with you is the short and easy Python program using which you can download any Youtube video. You can enhance or update the codes to upgrade its features as well. While doing so, if you get stuck, then also you can ask us. Here is a simple but amazing Python program to download a youtube video in its highest quality. So let's see the implementation first, that how it actually works. Now, coming towards the coding segment. Here is the code to do the above like operation. A simple python code through which you can easily download a youtube vidoe in your system. import pytube print("Give URL: ") url = input() pytube.YouTube(url).streams.get_highest_resolution().download('../Video')

    • ATC Journal - Tech Blog for Coders | AskTheCode

      ATC Journal Home Raise A Query Coding Solutions ATC Journal ATC Community About ATC More... Progrmmer's Hub Programming Amazing Programs eLearning Coupon Subscribe us Coders' Stuffs Ask Us Log in / Sign up Hey Programmers, Welcome to ATC Journal. Here is something that every programmer needs to have an outstanding career ahead. AskTheCode has started a journal for you guys covering all about the programming languages and codes, apps, and techs. What you have to do is nothing but reading the post and utilize the source. You may even learn coding at home simply by reading the programming section of the ATC Journal. Whether you are a beginner to the programming language or an advanced one considered as a job-ready programmer, the blog is for everyone. We will be covering all that a programmer needs. So, stay updated with the blog. And encourage the community. Happy Coding. ATC Journal for tech blogs Explore the world of techs, wisdom, and ideas Some FAQ about Ask The Code & ATC Journal What is “AskTheCode”? AskTheCode is a community developed by a team of Indian Developers to help coders with their programming. Anyone from anywhere is most welcome at the site. Ask The Code is not only for Indian but from every corner of the world; just come and clear the code. Why does it include the term Indian Developer Community? Is it only for the Indian programmers? A group of Indian Developers started the community, so they included the term “Indian Developer Community.” Initially, Ask The Code was created by analyzing only Indian coders’ needs, but accordingly, Team ATC (core members) integrated it to help the people outside of India. Anyone from any corner of the earth can be a part of the community and enjoy a fantastic coding track. How to be a part of “AskTheCode”? To ask for the codes and join Team ATC, you can sign up via your Google account. And for the next time, you can sign in through that Google account. Thus, there is nothing to remember as a password, but your privacy is still secured. How to ask the questions here at ATC? To ask the code or any programming questions to Team ATC, go to the “Raise A Query” section, and ask your programming question. ​ Where to see the solutions to asked questions at Ask The Code community? To see the solution to queries raised here at AskTheCode community, go to the Coding Solutions page, where you’ll see the answers. Team ATC always notifies you after posting the solution to your query. What is ATC Journal? ATC Journal is an initiative of Ask The Code to provide coders whatever knowledge and info they might need to stay updated and benefited. This journal page is a blog published by the Team ATC for a tech-savvy person. ​ Why stay tuned at ATC Journal? ATC Journal is all about you, how you should enhance coding, how you can join an MNC and a lot of extra info to help stay updated with trends and techs. Ask The Code also gives you beneficial eLearning coupons free to support and make online courses accessible, especially the programming/coding related courses. You can find these coupons under eLearning coupons for free. Until then, Happy Coding. ​ Why join AskTheCode? Ask The Code is the best solutions providing platform you’ll find throughout the web. We encourage the learner, no matter where he is belonging, from India or out of India. But, our members are more privileged than this; we provide many excellent personalized and beneficial content (solutions, advisory, free eLearning coupons, and many more) to our coding community members.

    • AskTheCode | Indian Developer Community

      Log in / Sign up This is indicating to Ask The Code community. Clear doubts about programming questions by getting its solution at AskTheCode. You can get answer to your programming question at AskTheCode quickly. AskTheCode - a community for coders Community for Coders So hey dear upcoming coders. In this digital world, everything is now online. Whatever doubts arrive, the answer is easy to get. But when you ask your programming questions , have you got all your solutions? If your answer is no, then within a few minutes, your answer will be yes. Because here you will get answers to your programming questions free . Here we welcome all the curious coders, who want to be a great coder. Here we will give you answers to your questions related to coding. Whether your question, related to Java, Python, C, C++, or anything else related to coding. After coming here, now no more please answer my coding questions to others. Because you will be able to answer other questions related to coding. The main motive for creating this website, to find new talent and clear their doubts. If you don't know anything about coding or you are a coder. This platform for both. Our main agenda is to clear the doubt of every coder. So, come and join the Indian Developer Community by being connected here at ATC. Now, no more, who will answer my question? Now, it's time to compete with the world and say, yes, I know about coding. Description about AskTheCode platform Benefits of joining the ATC community AskTheCode community members benefits and advantages. AskTheCode is a safe & secure online community for coders to ask your programming questions. Our community members can enjoy many benefits that will contribute a lot to their career as a programmer. Members can get their solutions relatively quicker than normal visitors and enjoy many interesting segments, which will be updated timely. Becoming a member, you can ask us to get answers your programming questions . Also, they have full navigation access to the website. Additionally, a Coding Solutions segment is only accessible by the members, where they can also share their views on any particular question. Here, you'll get every setup and even answer competitive programming that will help you to become an emerging coder. Moreover, there is another member-only area called ATC Community ; here, all our members can create groups and share their questions, solutions, or views over any programming language. Also, they can share helpful posts with their friends very easily. Further, our members can follow their best answer provider to get in direct contact with them, and similarly, they can also be followed by any other member. The most trending member will be chosen for some extra benefits. So please hurry up and and enhance your coding effortlessly. join our ATC community ABOUT ATC Contact US E-mail id Welcome coders! Come and ask your doubts at Ask The Code - an Indian Developer Community. ATC is a programmer community that is available to all. Here you don't need to pay anything. The only thing you need to pay is attention. It's free and for all. So let's be together and develop our India Developer Community as the most influential in coding. Join Team ATC and feel your developer path as hurdle free path. Just ask your programming questions here and get its solution in the quickest time. By being a member of our community, you will not only experience development in your coding skill but will be helping others too, due to which there will be no obstacle in the growth of our Indian Programmers. So come and shake hands with us, join team ATC. You just take a step, and we will help you cross all the obstacles in your coder part. So come forward, ask your doubts, get your answer, and emphasize your journey as a coder. Team ATC will be helping you to become efficient as well as a coder dispelled of any doubts. So come and be a part of our dream to accomplish your desire to be a doubtless coder. Subscribe Alert From Us Subscribe ATC You've been subscribed.

    View All

"Believe you can and you're halfway there"