Decision making and branching - c# program, DOT NET Programming

Assignment Help:

Decision Making and Branching - C# Program

Need Programming help on Decision Making and Branching in C#.


Related Discussions:- Decision making and branching - c# program

Web service based application, Web Service based application: ...

Web Service based application: Aims and Objectives Classics Online is a Web-based book and music retailer specialising in pre-1980s hardback

What happens when aspx page is requested from browser ?, The steps that occ...

The steps that occur when we request a ASPX page are as follows:- 1) The browser sends the request to the webserver. Now  assume that the webserver at the other end is IIS. 2

Explain the architecture of ado.net in brief, Explain the architecture of A...

Explain the architecture of ADO.NET in brief. AD0.NET having of two fundamental components: The DataSet, which is disconnected from the data source and does not require to k

Title..case statement, Design an interface and add code to command buttons ...

Design an interface and add code to command buttons using case statement, to find coursework to be calculated using formula 0.6*1/6*total Mark

Implement prototype pattern in .net, How do you implement prototype pattern...

How do you implement prototype pattern in .NET? The Cloning is achieved by using the ICloneable of the System namespace. It has a "Clone" method that actually returns the refer

Describe what are streams in file handling, Question : (a) Describe wh...

Question : (a) Describe what are streams in file handling and explain what should be done when accessing data in an existing file. (b) For what purpose are StreamReader an

Define inheritance, Can you define what inheritance is and an example of wh...

Can you define what inheritance is and an example of when you might use it? The process of deriving a new class from an existing class is known as Inheritance. The old class is

Simple walk through of xmlreader, Explain simple Walk through of XmlReader....

Explain simple Walk through of XmlReader. In this part we will do a simple walkthrough of how to use the "XmlReader" class. The Sample for the same is available in both languag

What is semantic gap, What is semantic gap? Defining a useful channel i...

What is semantic gap? Defining a useful channel includes both understanding the applications requirements and recognizing the limitations of the underlying technology. The gap

Looking to build fifa coins selling and buying website, Looking to build FI...

Looking to build FIFA coins selling and buying website Project Description: I would like a website made for FIFA 14 TEAM. What this website will do is having automatically bu

james

2/11/2013 7:47:08 AM

This program will help you, try it out

using System;  

class SumOfOdds

{

  public static void Main()

 {

   int x=0, sumodd=0, sumeven=0, sumdiv7 = 0 ,totalno7 = 0, i;    

   for (i=0 ; i<=20 ; i++)

  {

   x = i % 2;

    if (x != 0)

   {

    sumodd = sumodd + i;

   }

    if (x == 0)

   {

    sumeven = sumeven + i;

   }

  }  

   //checking for the sum & no. of numbers divisible by 7    

  x = 0; // resetting the value of ''x''

   for (i=100; i<=200;i++)

  {

   x = i % 7;

    if (x == 0)

   {

    sumdiv7 = sumdiv7 + i;

    totalno7 = totalno7 + 1;

   }   

}     

  Console.WriteLine("Sum of all odd numbers from 1 - 20 = " + sumodd + "\n");

  Console.WriteLine("Sum of all even numbers from 1 - 20 = " + sumeven + "\n");

  Console.WriteLine("Sum of all numbers from 100 - 200, divisible by 7 = " +

sumdiv7 + "\n");

  Console.WriteLine("Total numbers from 100 - 200, divisible by 7  = " + totalno7 + "\n");

   Console.ReadLine();

 }

}

2/11/2013 7:48:14 AM

Hey John i have the ouput of above program:

Output:
Sum of all odd numbers from 1 - 20 = 100
Sum of all even numbers from 1 - 20 = 110
Sum of all numbers from 100 - 200, divisible by 7 = 2107
Total numbers from 100 - 200, divisible by 7  = 14.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd