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 application and web service, Web Application and Web Service For t...

Web Application and Web Service For this part of the assignment, you are to develop a web application and web service using technologies and techniques taught in this subject

Collation sequence in sql server, Explain collation sequence in sql server....

Explain collation sequence in sql server. The Collation sequences are the set of rules which determine how the data is sorted and compared. The Sorting rules can be defined wit

I need cloudflare api interface to c#, I need CloudFlare API interface to C...

I need CloudFlare API interface to C# Project Description: We require a small piece of C# .NET code, integrated in an object, that will interface with CloudFlare's API and ge

Develope a microblogging and bookmarking site, General Overview A number...

General Overview A number of organisations are using micro-blogging as a cost-effective way of communicating with customers, building online communities and releasing informatio

We need in asp.net mvc site, We need in ASP.NET Mvc site I have project ...

We need in ASP.NET Mvc site I have project should be done with MVC.NET technology. In general- I have by now the site Layout (Html-js-css) I need- a) Simple CMS allo

Raid and its working, What is RAID and how does it work? The Redundant ...

What is RAID and how does it work? The Redundant Array of Independent Disks (RAID) is a term used for describing the technique of improving data availability through the use of

What is a dynamic update, What is a dynamic update? Dynamic update is a...

What is a dynamic update? Dynamic update is a powerful feature of WF that describes the ability of WF to modify the implementation path of a running workflow. This feature is u

Interface, What is a Interface? The Interface is a contract that descri...

What is a Interface? The Interface is a contract that describes the signature of the functionality. So when a class is implementing a interface it says to the outer world, that

In search of urgent assistance with loading an asp.net site, In search of u...

In search of urgent assistance with loading an ASP.net website In search of assistance with loading an ASP.net website installation onto a new server, job will start nearly D

Modes of storing asp.net session, What are the modes of storing ASP.NET ses...

What are the modes of storing ASP.NET session? 1) InProc: - In InProc mode Session state is stored in the memory space of the Aspnet_wp.exe process. That is the default setti

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