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

Briefly explain how server form post-back works, Briefly explain how server...

Briefly explain how server form post-back works ?  Post Back: The process in which a Web page sends data back to the similar page on the server. View State : View State i

Web application and xml data storage, Web application and XML data storage ...

Web application and XML data storage One person should create a library (Java package of classes) for managing the list of bibliography entries, and for saving and loading th

Class in dot net, What is a Class in dot Net? The class describes all t...

What is a Class in dot Net? The class describes all the attributes of objects, as well as the methods which implement the behavior of member objects. It is a comprehensive data

C# program, Write a program interactively two integers using the method con...

Write a program interactively two integers using the method console.readline and int.parse and display their sum

Checking for validity of an expression - c# program, Checking for validity ...

Checking for validity of an expression - C# Program Hello can you please provide me some examples regarding to the Checking for validity of an   expression in C#.

Describe the architecture of the .net framework, Question: (a) What is...

Question: (a) What is VB.NET 2005 and explain the versions of VB.NET. Name the four different types of applications that new version of VB.NET can create. (b) Using the

We need a .net synchronisation of bugnet, We need a .NET Synchronisation of...

We need a .NET Synchronisation of BugNet -> Paymo -> Insightly We need a small .net utility that is able to synchronise projects as well as tasks between three applications 1

List advantages of binding data to controls, Question: (a) List three ...

Question: (a) List three advantages of binding data to controls. (b) The Repeater control uses templates to control formatting. Define the five types of templates supporte

Common code, How do I write common code for different dot net framework dat...

How do I write common code for different dot net framework data providers?

I need a experienced microsoft .net web developer, Experienced Microsoft .N...

Experienced Microsoft .NET web developer The developer must be reliable as well as most of all use best practices for coding as well as application design. a) .NET 3.5 (ideal

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