My code is not giving the desired output

My code is not giving the desired output

Content Index :

My code is not giving the desired output
Tag : chash , By : Milander
Date : November 24 2020, 05:47 AM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Why this code not giving desired output?

Tag : c , By : terrestrial
Date : March 29 2020, 07:55 AM
this one helps. Try the fix below.
Note the 40.0 and 20.0 instead of 40 and 20. The issue is that you were doing integer division. 40 / 100 == 0, so da was always 0. Using 40.0 / 100 instead gives you floating point division and the value 0.4, which is what you want to make your calculations correct. (The same holds for the computation of hra.)
#include <stdio.h>

int main() {
    float da, hra, s, gs;

    scanf("%f", &s);

    da = 40.0 / 100 * s;
    hra = 20.0 / 100 * s;
    gs = s + da + hra;

    printf("%f", gs);

    return 0;

HTML is not giving desired output

Tag : html , By : Jesenko Mehmedbasic
Date : March 29 2020, 07:55 AM
this will help You should be getting some output - I tried pasting your code into a JSFiddle: https://jsfiddle.net/e247ghn9/1/
It seems like you're missing an opening tag, though. That might be why.
main {
  margin-top: 100px;

why is this code not giving the desired output?

Tag : cpp , By : toki
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I fear that your question will be closed by people on SO.
But let me give you the answer.
istringstream ss(str);
getline(cin, str);
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <sstream>

int main() {

    // Read a line and check, if that worked
    if (std::string str; std::getline(std::cin, str)) {

        // Create and initialize a std::istringstream
        std::istringstream iss(str);

        // Define a variable integers, use its range constructor with iterators
        std::vector integers(std::istream_iterator<int>(iss), {});

        // Range based for loop
        for (const int& i : integers) {
            std::cout << i << "\n";

    return 0;
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

int main() {
    // Source or test data. We put it directly into the stream;
    std::istringstream ss{ "1,2,3,  4  ,  5,6" };
    std::vector<int> integers{};
    char comma{};
    int integer{};

    while (ss)  {

        // Read integer and check, if it could be read
        if (ss >> integer) {
            std::cout << "Read Integer " << integer << "\n";
            std::cerr << "Error: Could not read integer\n";

        // Now read the comma
        if (ss && (ss >> comma))
            std::cout << "Read Comma: " << comma << "\n";
            std::cerr << "Error: Could not read comma\n";
    // SHow all values
    for (const int i : integers) std::cout << i << "\n";

    return 0;

Code not giving Desired output (Migratory Birds - HackerRank)

Tag : java , By : Nickolas
Date : March 29 2020, 07:55 AM
it should still fix some issue You need to do two things: Count the number of birds for each type, and then find the maximum. While you are trying to do that, you seem to be running into an issue of getting lost in your code by making it over-complicating it. Think about this: how many birds you could count and know which number that is all in the same data structure?
Just 1 array could accomplish this really well for you. You increment the correct index of the array each time you count, and then by going in order you can determine which bird is the highest number of sightings, and that index is the correct number.
  static int migratoryBirds(List<Integer> arr) {
    int[] birdCountArr = new int[6]; // bird numbers are guaranteed to be between [1,5], we ignore index 0.
    for(int n : arr) {
    int high = 0;
    int highBirdNum = 0;
    for(int i = 1; i < birdCountArr.length; i++) {
      if(birdCountArr[i] > high) {
        high = birdCountArr[i];
        highBirdNum = i;
    return highBirdNum;

My constructor is not giving the desired output

Tag : java , By : Robert Daniel Pickar
Date : March 29 2020, 07:55 AM
this will help From within a constructor, you can use the this keyword to call another constructor in the same class. Doing so is called an explicit constructor invocation.
public vipcustomer()//------------------------------------------------(C1)
public vipcustomer(int creditlimit, String emailid)//-----------------(C2)
public vipcustomer(String name, int creditlimit, String emailid)//----(C3)
new vipcustomer();
public vipcustomer() {
    this("Rupali", 5000, "rupalisingh@gmial.com");
    System.out.println("Constructer with default values");
Constructor with no default values
Constructor with no default values
Constructor with default values  
Related Posts Related QUESTIONS :
  • Why is Array.Length an int, and not an uint
  • How do I make event callbacks into my win forms thread safe?
  • Genealogy Tree Control
  • WCF Service - Backward compatibility issue
  • Binary patch-generation in C#
  • Tab Escape Character?
  • When do Request.Params and Request.Form differ?
  • The imported project "C:\Microsoft.CSharp.targets" was not found
  • Numeric Data Entry in WPF
  • Print a Winform/visual element
  • C# logic order and compiler behavior
  • When to use an extension method with lambda over LINQtoObjects to filter a collection?
  • How to make a button appear as if it is pressed?
  • C# and Arrow Keys
  • How do you resolve a domain name to an IP address with .NET/C#?
  • Should the folders in a solution match the namespace?
  • How can I evaluate C# code dynamically?
  • CSharpCodeProvider Compilation Performance
  • How can I create Prototype Methods (like JavaScript) in C#.Net?
  • DataTable Loop Performance Comparison
  • CSV string handling
  • What is the best way to do unit testing for ASP.NET 2.0 web pages?
  • High availability
  • What to use for Messaging with C#
  • Accessing a Dictionary.Keys Key through a numeric index
  • ConfigurationManager.AppSettings Performance Concerns
  • What Are Some Good .NET Profilers?
  • Is this a good way to determine OS Architecture?
  • How to create a tree-view preferences dialog type of interface in C#?
  • Searching directories for tons of files?
  • Can I have a method returning IEnumerator<T> and use it in a foreach loop?
  • Why can't I have abstract static methods in C#?
  • Displaying ad content from Respose.WriteFile()/ Response.ContentType
  • Convert integers to written numbers
  • Absolute path back to web-relative path
  • How can we generate getters and setters in Visual Studio?
  • Bringing Window to the Front in C# using Win32 API
  • Possible to "spin off" several GUI threads? (Not halting the system at Application.Run)
  • Reading a C/C++ data structure in C# from a byte array
  • How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox?
  • Setting Objects to Null/Nothing after use in .NET
  • Converting ARBG to RGB with alpha blending
  • Is it better to create Model classes or stick with generic database utility class?
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com