Write a C program to separate even and odd numbers of an array and put them in two separate arrays.

सी भाषा में एक प्रोग्राम लिखें जो:

1º) कुंजीपटल द्वारा एक संख्या (पूरे डेटा) के लिए पूछें

दूसरा) चरण 1 दोहराएं, जबकि दर्ज की गई संख्या शून्य से भिन्न है।

3) स्क्रीन पर उपयोगकर्ता द्वारा दर्ज अजीब और भी संख्याओं का योग दिखाएं।

स्क्रीन पर आप देखेंगे, उदाहरण के लिए:

प्रोग्राम की ऑन-स्क्रीन डिस्प्ले भी और अजीब संख्याओं का योग, सी भाषा में हल
समाधान: घोंसले के शिकार एक अगर एक देर लूप के अंदर
/ * प्रोग्राम: यहां तक ​​की और अजीब संख्याओं का योग * /

# शामिल करें
# शामिल करें

int main ()
{
इंट नंबर, जोड़े, अजीब;

printf (“\ n एक n% पूर्णांक संख्या दर्ज करें (0 = अंत):”, 163);
scanf (“% d”, और संख्या);

जोड़े = 0;
विचित्र = 0;

जबकि (संख्या! = 0)
{
अगर (संख्या% 2 == 0)
जोड़े + = संख्या;
अन्यथा
विषम + = संख्या;

printf (“\ n एक n% पूर्णांक संख्या दर्ज करें (0 = अंत):”, 163);
scanf (“% d”, और संख्या);
}

printf (“\ n जोड़े का योग है:% d”, जोड़े);
printf (“\ n \ n अजीब का योग है:% d”, अजीब);

मिल (); / * रोकें * /

वापसी 0;
}
ध्यान दें, केवल उस मामले में जब उपयोगकर्ता द्वारा दर्ज पहली संख्या शून्य है, तब जबकि लूप किसी भी समय फिर से नहीं होगा।
Analysis of algorithms and data structures, their order, their typology and their implementation in different languages

Afflluence Writng Service

You may also like...

2 Responses

  1. 2017

    […] Previous story Write a C program to separate even and odd numbers of an array and put them in two se… […]

  2. 2017

    […] Write a C program to determine a given matrix is a sparse matrix. says: […] Previous story Write a C program to separate even and… […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!