Quarter 1, Week 3 Worksheet No. 2 C# Basic Syntax Activity 1 (Answers)
Quarter 1, Week 3 Worksheet No. 2 C# Basic Syntax Activity 1 (Answers)
Quarter 1, Week 3 Worksheet No. 2 C# Basic Syntax Activity 1 (Answers)
NET PROGRAMMING
QUARTER 1, WEEK 3
WORKSHEET NO. 2
C# Basic Syntax
Activity 1
(Answers)
1) Access modifier
4) x= Convert.ToInt32(Console.ReadLine());
6) y= Convert.ToInt32 (Console.Readline());
8) z= Convert.ToInt32 (Console.ReadLine());
9) result =x*y*z;
Using System
public class Add
{//Begin
static void main(String[] args)
{
string name;
//Variable
Int numA //1st number
Int numB//2nd number
Int numC//3rd number
Int sum // result.,
Console.WriteLine(“Hello,{0}”,name);
Console.WriteLine(“the total is={0}”,sum);
Activity 1
My First C#Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace First_c_sharp_code
class Program
Console.WriteLine("Milben Cera");
name = Console.ReadLine();
//Displaying Output
Console.ReadLine();
}
}
.NET PROGRAMMING
QUARTER 1, WEEK 3
C# Basic Syntax
Activity 1
1)True 6)False
2)True 7)False
3)False 8)True
4)True 9)True
5)True 10)True
QUARTER 1, WEEK 3-4
WORKSHEET # 1
JAVA PROGRAMMING
PERFORMANCE 7
import java.util.Scanner;
classFC
{
(ANSWERS)
1) Create a console program that will display the average of ten digits from the user. (50 points)
using System;
int i,n,sum=0;
double avg;
Console.Write("\n\n");
Console.Write("----------------------------------------------");
Console.Write("\n\n");
for (i=1;i<=10;i++)
Console.Write("Number-{0} :",i);
n= Convert.ToInt32(Console.ReadLine());
sum +=n;
avg=sum/10.0;
}
2) create a console program that will display the following stars formation below.
A) 50 points
input:
using System;
class Pyramid
Console.Write("*");
Console.Write("\n\n");
output:
B) 50 points
input:
using System;
class Pyramid
Console.Write(" *");
Console.Write("\n\n");
output: