ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Select error in the given program?

  1. Static Void Main(String[] args)
  2. {
  3. const int m = ;
  4. int n = ;
  5. const int k = n / 5 * * n ;
  6. Console.WriteLine(m * k);
  7. Console.ReadLine();
  8. }

a) ‘k’ should not be declared constantb) Expression assigned to ‘k’ should be constant in naturec) Expression (m * k) is invalidd) ‘m ‘ is declared in invalid format

user-image
تم إضافة السؤال من قبل Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
تاريخ النشر: 2016/10/20
Sayed Elshayeb
من قبل Sayed Elshayeb , senior analyst programmer , EPL House

m,n definition is invalid

definition of k has 2 problems:

  1. you can't assign a variable to const
  2. the double * means that n is a pointer, if you need the power use the "Math" class

Awwab Ahmed
من قبل Awwab Ahmed , Web-Developer, Graphic-Designer. , Conobio

b) Expression assigned to ‘k’ should be constant in nature

Mohammad Nadir Roshan
من قبل Mohammad Nadir Roshan , Technical Support Specialist , FreeBalance Co

There are 3 major errors:

1.Two invalid expression term ';' which are for "m=;" and "n=;" as they need to be initialized (given a value).

2. The * or -> operator must be applied to a pointer: which in the line 5 (const int k = n / 5 * * n ;)

     a. operator is invalid for "5**n)

     b. And we have never declared a pointer to use a "*n" also.

3.The expression being assigned to 'k' must be constant: meaning that constant values should be constant and there is no way you could assign a variable to a constant.

Mohannad Bakbouk
من قبل Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb

There are Error in code 

i'm sorry for that 

  1. const int m =1 ;
  2. int n =5;

Shahid Salam Khan
من قبل Shahid Salam Khan , Software Engineer , Xavient Information Systems

Everything is wrong except Console.WriteLine and readline

Pathan Zarrar Khadar Khan
من قبل Pathan Zarrar Khadar Khan , Windows System Administrator , Dyce Tech Pvt Ltd

const int m = ;  Invalid Declaration 

 

Hassan Elsherbiny
من قبل Hassan Elsherbiny , .Net Developer , Al-dar international

const int m = '//This Should has a value

int n = ;//This Should has a value

const int k = n / 5 * * n ; //** Is Not valid operator

المزيد من الأسئلة المماثلة