What's new

Need Help for C programming :)

But i told you to ask your question in here... :D

Very good idea indeed... :unsure:

I have a shit load of c# codes :fie:
Seems like you guys wait till the last moment to submit your assignment. :p:
 
break is for ending the loop in case any exception is thrown like a decimal number or something indivisible first run this program as it is and see if its error free i dont have a C compiler with me so can't promise a error free run first do that and post the result.


also my name is hannah:mad::mad::mad::mad::sick:
Or just throw an exception if anything else than a positive integer is put in during input since the modulo already takes care of decimal places.
 
First time I have seen a German language program in C

I was expecting something like this:

#include<blitzkrieg.h>
#include<bmw.h>

void mein (void)
{
printFlak("\n Heil Deutschland ");
kaputt(1);
}
 
you are number 1 man <3 :)
so did you combined the code? please post the final result would like to see the final result:-)

First time I have seen a German language program in C

I was expecting something like this:

#include<blitzkrieg.h>
#include<bmw.h>

void mein (void)
{
printFlak("\n Heil Deutschland ");
kaputt(1);
}
might i add ze anozer file <panzer.h>:D:D:D:D
 
so did you combined the code? please post the final result would like to see the final result:-)


might i add ze anozer file <panzer.h>:D:D:D:D


I did insert your part for the prime if in my old code

Code:
#include <stdio.h>
int main()
{
    int input, i, output = 0;
    printf("\n\n=== Aufgabe 3 ===\n\n");
    printf("\nBitte eine positive, ganze Zahl eingeben:\n ");
    scanf("%d", &input);
    if(input<0){
        printf("\nFehler: Die eingegebene Zahl %d war negativ!", input);
        return 0;
    }
    for(i=2; i<=input/2; i++){
        //Bedingung für nicht Primzahl
        if(input % i == 0){
            output = 1;
            break;
        }
    }
    if(output == 0)
        printf("\nDeine Zahl %d ist eine Primzahl\n", input);
    else
        printf("\nDeine Zahl %d ist keine Primzahl\n", input);
    return 0;
}
@Hannah_Kravitz this is mostly your work, I am really thankful! I cannot believe it you did this in a few minutes while i tried the same for hours. Im stupid :(

First time I have seen a German language program in C

I was expecting something like this:

#include<blitzkrieg.h>
#include<bmw.h>

void mein (void)
{
printFlak("\n Heil Deutschland ");
kaputt(1);
}



come on :D
these dark days are thanks god over.
 
While your at it include
Uboot.h
Panzerfaust.h :-)
how about ze
<volkswagen.h>
<beer.h>
<V2.h>
<sauerkraut.h>

shit this is pure goldmine:D:rofl::rofl::rofl::rofl:

I did insert your part for the prime if in my old code

Code:
#include <stdio.h>
int main()
{
    int input, i, output = 0;
    printf("\n\n=== Aufgabe 3 ===\n\n");
    printf("\nBitte eine positive, ganze Zahl eingeben:\n ");
    scanf("%d", &input);
    if(input<0){
        printf("\nFehler: Die eingegebene Zahl %d war negativ!", input);
        return 0;
    }
    for(i=2; i<=input/2; i++){
        //Bedingung für nicht Primzahl
        if(input % i == 0){
            output = 1;
            break;
        }
    }
    if(output == 0)
        printf("\nDeine Zahl %d ist eine Primzahl\n", input);
    else
        printf("\nDeine Zahl %d ist keine Primzahl\n", input);
    return 0;
}
@Hannah_Kravitz this is mostly your work, I am really thankful! I cannot believe it you did this in a few minutes while i tried the same for hours. Im stupid :(





come on :D
these dark days are thanks god over.
it's okay you'll learn with time and practice C is a lovely language and just having some fun mien freund
 
image.jpg
Sum of first n number squared? Well here is a program in SB, but can be written in C easily.
http://smallbasic.com/program/?MJP126 i did this in 2013.
 
Another question:

I have to write a pseudocode and draw a flowchart for this problem
Integer factorization

means it should calculate the prime factors of a integer poitive number.

Like
10= 2*5
25=5*5
625=25*25*=5*5*5*5
100=10*10=2*2*5*5
11=1*11

All the numbers on the right side are primes
rule says: you can build all numbers with the multiplication of primenumbers i think.

I came that far:

1.Scanf input from user =n
2.If n is primenumber v (or) 1 => output=input
3.Else

so im now at the 3rd step, how do i go on?
 
@Hannah_Kravitz this is mostly your work, I am really thankful! I cannot believe it you did this in a few minutes while i tried the same for hours. Im stupid :(

My advice for you will be to write code on paper first, just use pen/pencil and paper. It increases your dependability on your own brain rather than on a compiler, which ultimately makes your brain a compiler. You can easily erase, strike through or amend your code on a paper better than on a computer screen. A paper also gives you space to see the results in run time (You will understand it once you start writing code on a paper).
Once on a computer, your brain already starts depending on compiler, which slows down you brain and learning becomes harder, try P/PP i mean Pen/Pencil Paper coding, i think it will help you a lot. I know from my experience.
 
Back
Top Bottom