Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop
    1. Home
    2. Kalana
    3. Best
    • Profile
    • Following 8
    • Followers 5
    • Topics 17
    • Posts 53
    • Best 29
    • Controversial 0
    • Groups 0

    Best posts made by Kalana

    • RE: php form එකක තියෙන variable එකක් තව multiple pages වලට යවන්නේ(පෙන්නන්නේ) කොහොමද php වලින්.

      ප්‍රශ්නයේ හැටියට ඔයා PHP වලට අලුත් කෙනෙක් වගේ පේන්නේ. මේකට ඔයා ට්‍රයි කරපු code එකත් දැම්මනම් වැඩේ ලේසියි. මන් මේකට මෙහෙම උදව්වක් කරන්නම්. ඔයා input කරන විස්තර ඒ ඒ අදාල variable එකේ store වෙනවා. ඊට් පස්සේ ඔයාට තියෙන්නේ ඒ store කරගත්තු variable ටික page_one.php එකටයි page_two.php එකටයි call කරන එක.

      ඔයා මෙහෙම කරන්න. Google එකට ගිහින් crud operations in php කියලා සර්ච් කරන්න. නැත්තම් https://www.tutorialrepublic.com/php-tutorial/php-mysql-crud-application.php ඔය ලින්ක් එකට ගිහින් බලන්න. එතකොට ඔයාට idea එකක් එයි. ඒකෙත් ඔයාගේ ප්‍රශ්නයට අදාල වෙන කොටස තියෙන්නේ Creating the Read Page කියන කොටසේ.

      posted in General Discussion
      Kalana
      Kalana
    • RE: Adobe Illustrator Logo Designing [Sinhala] | Class No-02

      Good work! keep it up

      posted in Graphic Design & Video Editing
      Kalana
      Kalana
    • C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 2))

      කලින් කොටසේ අපි ඉගෙන ගත්තා if, else if, else වැඩ කරන විදිහ හා ඒවා භාවිතා කරන ආකාරය පිලිබද. මේ කොටසින් මන් තව දුරටත් මේ statement එක ගැන කතා කිරීමට බලාපොරොත්තු වෙනවා.

      අපි දැන් බලමු && (AND), || (OR), ! (NOT) gates if condition එකක් ඇතුලේ වැඩ කරන ආකාරය. &&, ||, ! ගැන මන් මගේ කලින් ලිපියක සඳහන් කලා

      C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators) -: https://bit.ly/2ruMH22

      &&(AND)

      • කලින් ලිපියේ අපිට 0 ට වඩා විශාල සංඛ්‍යා සෙවීමට දුන් විට අපි if(num > 0) භාවිතා කලා.

      • ඒ වගේම අපිට 0 ට වඩා කුඩා සංඛ්‍යා සෙවීමට දුන් විට අපි if(num < 0) භාවිතා කලා.

      • නමුත් අපිට කිව්වොත් 0 ත් 100ත් අතර සංඛ්‍යාවක් සෙවීමට දුන්නොත් කොහොමද if එකක් යොදාගෙන ඒ දේ කරන්නේ

      මන් මේක සරල ප්‍රශ්නයක් ඔස්සේ පැහැදිලි කරන්නම්.

      Question 1 -: Write a C program to input number from keyboard. find out that number in between 0 and 100. If it is true
      display a message called "success" otherwise display a message "fail".

      මේ ප්‍රශ්නෙන් කියවෙන්නේ අපි සංඛ්‍යාවක් input කරපු විට එම සංඛ්‍යාව 0 ත් 100 ත් අතර පවතින සංඛ්‍යාවක් නම් "success" කියලා message එකක් එන්න ඕන. එම සංඛ්‍යාව 0 ත් 100 ත් අතර නැතිනම්
      "fail" කියලා message එකක් එන්න ඕන. මන් මේක පියවර ආකාරයෙන් පැහැදිලි කරන්නම්.

      • අපි 0 ට වැඩි සංඛ්‍යා නිරූපණය කරන්නේ num > 0 මගින්. (num කියලා කියන්නේ අපි ගත්තු random variable එකක්)

      • අපි 100 ට වඩා අඩු සංඛ්‍යා නිරූපණය කරන්නේ num < 100 මගින්.

      • ** එම නිසා 0 ත් 100 ත් අතර සංඛ්‍යාවක් වීමට නම් num කියන variable එක 0 < num < 100 මේ විදිහට පැවතිය යුතුය.** එනම් num > 0 හා num < 100 යන කරුණු දෙක එකවර
        සත්‍ය විය යුතුය. කරුණු එකකට වඩා වැඩි ගණනක් එක වර සත්‍යදැයි බලන gate එක වන්නේ AND(&&) gate එකයි. අපි දැන් මේ ප්‍රශ්නය විසදමු.

      #include <stdio.h>
      
      int main()
      {
          int num;
          
          printf("Enter a number = ");
          scanf("%d", &num); //කිසියම් සංඛ්‍යාවක් input කිරීම
          
          if(num > 0 && num < 100) //එම සංඛ්‍යාව 0ට වඩා විශාල හා 100ට වඩා කුඩානම්
          {
              printf("Success");
          }
          else //එම සංඛ්‍යාව 0ත් 100ත් අතර නොමැතිනම්
          {
              printf("fail");
          }
          
          return 0;
      }
      
      First run -: Enter a number = 50                                                                                                  
                   Success
      
      Second run-: Enter a number = 105                                                                                                  
                   fail   
      
      Third run -: Enter a number = -20                                                                                                 
                   fail 
      

      ||(OR)

      මේකෙන් කරන්නේ කරුණු රාශියකින් එක කරුණක් හෝ සත්‍ය නම් ක්‍රියාත්මක වෙන එක. මන් මේකත් සරල උදාහරණයක් මඟින් දක්වන්නම්

      **Question 2 -: ** Write a C programm to input number from keyboard. That number should be smaller than 0 or
      greater than 100. otherwise display "fail" message.

      මේ ප්‍රශ්නෙන් කියවෙන්නේ අපි සංඛ්‍යාවක් input කරපු විට එම සංඛ්‍යාව 0 ට වඩා කුඩා හෝ 100 ට වඩා විශාල බව සොයන්න යන්නයි. මෙම අවස්තාවේදී අපි 0ත් 100ත් අතර සංඛ්‍යාවක් ඇතුලත් කලොත්
      "fail" කියලා message එකක් display කල යුතු වේ.

      • එනම් num < 0 උනොත් සත්‍ය වේ. (success)
      • num > 100 උනොත් සත්‍ය වේ. (success)
      • 0 < num < 100 උනොත් අසත්‍ය වේ (fail)

      අපි දැන් මේ ප්‍රශ්නය විසදමු.

      #include <stdio.h>
      
      int main()
      {
          int num;
          
          printf("Enter a number = ");
          scanf("%d", &num); //කිසියම් සංඛ්‍යාවක් input කිරීම
          
          if(num < 0 || num > 100) //සංඛ්‍යාව 0ට වඩා කුඩා හෝ සංඛ්‍යාව 100ට වඩා විශාල නම්. එනම් මෙම කාරණා දෙකෙන් එක කාරණයක් සත්‍ය විය යුතුය.
          {
              printf("Success");
          }
          else //සංඛ්‍යාව 0ත් 100ත් අතර පවතී නම්
          {
              printf("fail");
          }
          
          return 0;
      }
      
      First run -: Enter a number = 105                                                                                                 
                   Success
      
      Second run-: Enter a number = -5                                                                                                 
                   Success   
      
      Third run -: Enter a number = 40                                                                                                 
                   fail 
      

      ! (NOT)

      දී ඇති කාරණය සත්‍ය නම් එය අසත්‍යක් ලෙස පිලිගැනීම මෙමගින් සිදු කරයි.

      **Question 3 -: ** Write a C programm to input number from keyboard. If that number not equal to 0 display "success" message.
      otherwise display "fail" message.

      මෙහිදී කියන්නේ ඔබ ඇතුලත් කරන සංඛ්‍යාව 0ට අසමාන නම් "success" කියලා message එකක් output කරන්න කියලා. 0ට සමාන නම් "fail" කියලා message එකක් output කල යුතුයි.

      අපි දැන් මේ ප්‍රශ්නය විසදමු.

      #include <stdio.h>
      
      int main()
      {
          int num;
          
          printf("Enter a number = ");
          scanf("%d", &num); //කිසියම් සංඛ්‍යාවක් input කිරීම
          
          if(!(num == 0)) //එම සංඛ්‍යාව 0 සමඟ සසදා එය අසත්‍යනම් එය සත්‍යක් ලෙස ගැනීම
          {
              printf("Success");
          }
          else // //එම සංඛ්‍යාව 0 සමඟ සසදා එය සත්‍යනම් එය අසත්‍යක් ලෙස ගැනීම
          {
              printf("fail");
          }
          
          return 0;
      }
      
      First run -: Enter a number = 5                                                                                                 
                   Success
      
      Second run-: Enter a number = 0                                                                                                 
                   fail   
      

      අපි අවසාන වශයෙන් තරමක් දිගු C application එකක් සාදමු.

      Question 4 -: write a program to fulfill this table

            Mark             Grade
      100 >= Mark >= 80         A
       79 >= Mark >= 70         B
       69 >= Mark >= 45         C
         0>= Mark <= 44         F
           Otherwise          Error
      
      #include <stdio.h>
      
      int main()
      {
          int mark;
          
          printf("Enter a mark = ");
          scanf("%d", &mark); //කිසියම් සංඛ්‍යාවක් input කිරීම
          
          if(mark <= 100 && mark >= 80) //එම සංඛ්‍යාව 100 හා 80 අතර ඇත්නම්
      	{ 
              printf("A Grade");
          }
          else if(mark <= 79 && mark >= 70)  //එම සංඛ්‍යාව 79 හා 70 අතර ඇත්නම්
      	{
              printf("B Grade");
          }
          else if(mark <= 69 && mark >= 45)  //එම සංඛ්‍යාව 69 හා 45 අතර ඇත්නම්
      	{
              printf("C Grade");
          }
          else if(mark <= 44 && mark >= 0)  //එම සංඛ්‍යාව 44 හා 0 අතර ඇත්නම්
      	{
              printf("F Grade");
          }
          else  //එම සංඛ්‍යාව 100 වඩා වැඩි හෝ 0 ට වඩා අඩුනම්
      	{
              printf("Error");
          }
          
          return 0;
      }
      
      First run -: Enter a mark = 90                                                                                                  
                   A Grade
      
      Second run-: Enter a mark = 70                                                                                                  
                   B Grade   
      
      Third run -: Enter a mark = 50                                                                                                 
                   C Grade 
      
      Forth run -: Enter a mark = 35                                                                                                
                   F Grade 
      
      Fifth run -: Enter a mark = -5                                                                                                 
                   Error 
      
      Sixth run -: Enter a mark = 105                                                                                                
                   Error 
      

      මන් මේ පිලිබද ප්‍රශ්න කිහිපයකුත් දාන්නම් ඒවගේ උත්තරත් එක්ක.

      1. Obtain two numbers from the keyboard and display the larger number.

      answer -> https://drive.google.com/open?id=1_HwG20mPZOdRcl3Hakorim9KixD4howV

      1. Enter the final mark of a student and display “Pass” or “Fail”. Student should get more than 45 marks to pass a subject.

      answer -> https://drive.google.com/open?id=1ZM65EF1eBzgVR86egEjXkRkAYjvTIEEW

      1. Read an integer from the keyboard. If the number is > 0 display “number is positive”.
        If number is zero display “ Number is zero”. Otherwise display “Number is negative”.

      answer -> https://drive.google.com/open?id=1AGC9wTuQgRQXCtB4S_3XGvbs8AGBc9m6

      1. Develop a C program to determine if a customer has exceeded the credit limit on an account. Following details are
        taken from the keyboard.
      • Account Number
      • Balance at the beginning of the month
      • Allowed Credit Limit
      • Total credits
      • Total charges

      Calculate the new balance (= balance at the beginning + charges – credits) and determine if the new balance exceeds
      credit limit. The program should display the new balance and the message, “Credit Limit exceeded”.

      answer -> https://drive.google.com/open?id=1ZwiClrRQ-rPX9cx2XNX3XF6mWhT3SDeH

      1. Develop a program that will determine the gross pay for employees. The company pays “straight time” for the first
        40 hours worked by the employee and pays “time-and-a –half” for all hours excess of 40 hours.
        Write a C program to enter the no of hours worked, hourly rate and calculate the employee’s gross pay.

      answer -> https://drive.google.com/open?id=1ua96xG_lfxdDtHOqWwu-e6RzUFb5m6nd

      • C programm එකක් windows වල run කරන විදිහ --> https://bit.ly/2O6rLXR

      ඔබට අවශ්‍යනම් ඔබේ බ්‍රව්සර් එක හරහා online C programms run කරන්න පුලුවන්. එහෙම කරන්න පුලුවන් ලින්ක්ස් මන් පහතින් දාන්නම්

      • https://www.onlinegdb.com/online_c_compiler
      • https://www.tutorialspoint.com/compile_c_online.php
      • https://repl.it/languages/c

      සරලව මුල ඉදන් C programming ඉගෙන ගන්න පුලුවන් හොදම site දෙකත් මන් දාන්නම්

      • https://www.geeksforgeeks.org/c-programming-language/
      • https://www.tutorialspoint.com/cprogramming/index.htm

      මගේ කලින් ලිපි

      • C Programming මුල සිට ඉගෙනගනිමු(part 1 - Introduction) -: https://bit.ly/2O6rLXR
      • C Programming මුල සිට ඉගෙනගනිමු (part 2 - Variables) -: https://bit.ly/2spD6Kn
      • C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators) -: https://bit.ly/2ruMH22
      • C Programming මුල සිට ඉගෙනගනිමු (part 4 - Input & Output functions) -: https://bit.ly/2qU8IaK
      • C Programming මුල සිට ඉගෙනගනිමු (part 5 - create simple applications) -: https://bit.ly/2DDfy7b
      • C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 1)) -: https://bit.ly/2LiVsmZ

      මන් ඊළග ලිපියෙන් කියලා දෙන්නම් switch statement ගැන . මගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.
      තව ලිපියකින් හම්බෙමු ජය වේවා.

      posted in Blogs
      Kalana
      Kalana
    • RE: php form එකක තියෙන variable එකක් තව multiple pages වලට යවන්නේ(පෙන්නන්නේ) කොහොමද php වලින්.

      @Kataz ප්‍රශ්නය තව ටිකක් පැහැදිලි කරානම් හරි. මට තේරුනෙත් ඔයා කිව්ව දේ වැරදියට

      posted in General Discussion
      Kalana
      Kalana
    • C Programming මුල සිට ඉගෙනගනිමු (part 8 - Switch Statement)

      සුභ දවසක් වේවා ඔයාලට. අද ම්න් කතා කරන්න බලාපොරොත්තු වෙන්නේ C Programming වල එන Switch Statement එක ගැනයි. Switch Statement එක කියන්නේ අපි කලින් කතා කරපු
      if-else statement එකට සමාන දෙයකි. මෙහිදීද කරන්නේ අප ගත් තීරණයක් හරිද වැරදිද කියලා සොයා බැලීමයි.

      අපි දැන් බලමු Switch Statement එකේ ආකෘතිය මොන වගේ එකක්ද කියලා.

      switch(variable)
      {
      	case condition1 : //codes
      			  //codes
      			  break;
      	
      	case condition2 : //codes
      			  //codes
      			  break;
      					  
      	default : //codes
      		  //codes
      		  break;
      }
      
      • switch(variable) -: මෙහිදී සිදුවන්නේ අපට පරීක්ශා කිරීමට සිදුවන variable එක switch එකක් තුල store කර ගැනීමයි. එසේ කල විට අපට if-else වගේ නැවත නැවත එම
        variable එක ලිවීමට අව්ශ්‍ය නොවේ.

      • case condition1 : //codes -: මෙහිදී අප කරන්නේ අප ඇතුලත් කරපු දත්තය සත්‍ය හෝ අසත්‍යදැයි බැලීමයි. සත්‍ය නම් අපගේ //codes ටික execute වන අතර අසත්‍යනම් ඊලග
        case එක execute වේ. මෙය හරියට if-else වල එන if එකට හා elseif` එකට සමාන වේන්

      • default : //codes -: මෙය හරියටම if-else වල එන else වලට සමාන වේ. කිසිම case එකක් සත්‍ය නොවේනම් default එක ක්‍රියාත්මක වේ. මෙයට කිසිවිටකත්
        condition එකක් නැත.

      • break; -: මෙය යොදන්නේ case හා default සියල්ලම එකවර execute වීම වැලැක්වීමටයි. මෙය යෙදුවේ නැති වුවහොත් case හා default සියල්ලන්ගේම ඇති codes
        run වේ. මෙය මගින් කිසියම් case එකක් සත්‍ය වුවහොත් එම case එක පමණක් run වී සම්පූර්ණswitch(){} එකෙන් අපව එලියට ගෙන යයි.

      Switch Statement භාවිත කිරීමේදී අප නීති කිහිපයක් අනුගමනය කලයුතු වනවා.

      1. switch(variable) මෙහි එන variable එක සෑම විටම integer හෝ character එකක් විය යුතු වනවා. එය කිසිවිටකත් float විය නොහැකිය.
      2. case condition : මෙහි එන condition එකත් සෑම විටම integer හෝ character එකක් විය යුතු වනවා.
      3. case condition : මෙහි එන condition භාවිතා කල හැක්කේ switch එකක් තුල පමණි.
      4. break; අනිවාර්‍ය අංගයක් නොවන අතර එය භාවිතා කරන්නේ. එකවර case කිහිපයක් run වීම වැලැක්වීමටයි.

      මන් කිව්ව ගොඩක් දේවල් පැහැදිලි වෙයි මේ උදාහරණයෙන්.

      Example -: Input any number from the keyboard. After that check the following using switch statement

      • number == 25 , print "number is equal to 25"
      • number == 50 , print "number is equal to 50"
      • number == 75 , print "number is equal to 75"
      • else, print "Your number is not equal to 25, 50 or 75"

      write a C program to fulfill this conditions.

      මෙහිදී කියන්නේ කිසියම් සංඛ්‍යාවක් ඇතුලත් කල විට එය 25, 50, 75 ට සමානනම් සමාන ලෙසත් සමාන නොවේනම් සමාන නොවේ ලෙසත් output කල යුතු බවයි.

      #include <stdio.h>
      
      int main()
      {
          int number;
          
          printf("Enter a number = "); //කිසියම් සංඛ්‍යාවක් ඇතුලත් කිරීම.
          scanf("%d",&number);
          
          switch(number)
          {
              case 25 : printf("Number is equal to 25"); //ඇතුලත් කල සංඛ්‍යාව 25ට සමානනම්
                        break;
                        
              case 50 : printf("Number is equal to 50");//ඇතුලත් කල සංඛ්‍යාව 50ට සමානනම්
                        break;
                        
              case 75 : printf("Number is equal to 75");//ඇතුලත් කල සංඛ්‍යාව 75ට සමානනම්
                        break;
      
              default : printf("Number is not equal to 25, 50 or 75");//ඇතුලත් කල සංඛ්‍යාව 25, 50, 75 ට සමාන නොවේනම්
                        break;
          }
          return 0;
      }
      

      Output

      First run -: Enter a number = 25
                   Number is equal to 25
      			 
      Second run -: Enter a number = 50
                    Number is equal to 50
      			 
      Third run -: Enter a number = 75
                   Number is equal to 75
      			 
      Fourth run -: Enter a number = 100
                    Number is not equal to 25, 50 or 75
      

      අපි දැන් බලමු break; නැතුව මෙම code එක run කලාම ලැබෙන output එක මොකක්ද කියලා

      #include <stdio.h>
      
      int main()
      {
          int number;
          
          printf("enter a number = ");
          scanf("%d",&number);
          
          switch(number)
          {
              case 25 : printf("\nNumber is equal to 25"); //break; යොදා නැත
              case 50 : printf("\nNumber is equal to 50");
              case 75 : printf("\nNumber is equal to 75");
              default : printf("\nNumber is not equal to 25, 50 or 75");
          }
          return 0;
      }
      

      Output

      First run -: Enter a number = 25
                   Number is equal to 25
      	     Number is equal to 50
      	     Number is equal to 75
      	     Number is not equal to 25, 50 or 75
      			 
      Second run -: Enter a number = 50
                    Number is equal to 50
      	      Number is equal to 75
      	      Number is not equal to 25, 50 or 75
      			 
      Third run -: Enter a number = 75
                   Number is equal to 75
      	     Number is not equal to 25, 50 or 75
      			 
      Fourth run -: Enter a number = 100
                    Number is not equal to 25, 50 or 75
      

      ඉහත උදාහරණයෙන් උබට පෙනෙනවා break; එකක තිබෙන වටිනාකම හා switch එකක ක්‍රියාකාරිත්වය.

      if-else වල වගේ switch වලත් nested ආකාර පවතී. එනම් switch ඇතුලේ තව switch තිබීමට හැකිය.

      Example

      #include <stdio.h> 
      
      int main () 
      {  
          int number1;  
          int number2;  
          
          printf("Enter Number1 = ");
          scanf("%d", &number1);
             
          switch(number1) 
          {  
              case 10 : printf("Number1 is equal to 10");  
                        break;
                        
              case 20 : printf("Number1 is equal to 20 there for enter Number2 = ");
                        scanf("%d", &number2);
                        switch(number2) 
                        {  
                              case 50 : printf("Number2 equal to 50");  
                                        break;
                                        
                              default : printf("Number2 not equal to 50"); 
                        }
                        break;
                         
              default : printf("Number1 is not equal to 10 or 20");
             }  
              
             return 0;  
      }  
      

      Output

      First run -: Enter Number1 = 10
                   Number1 is equal to 10
      			 
      Second run -: Enter Number1 = 20
                    Number1 is equal to 20 there for enter Number2 = 50
      	      Number2 equal to 50
      			 
      Third run -: Enter Number1 = 20
                   Number1 is equal to 20 there for enter Number2 = 70
      	     Number2 not equal to 50
      			 
      Fourth run -: Enter Number1 = 100
                    Number1 is not equal to 10 or 20
      

      මන් ඔයාලට ප්‍රශ්න කිහිපයක් දෙන්නම් උත්තරත් එක්ක උත්සහ කරලා බලන්න කරන්න පුලුවන්ද කියලා. බැරි උනොත් හරි තේරෙන් නැත්තම් හරි මට message එකක් දාන්න.

      Question 1 -: Write a C program to create a simple calculator. The program should allow the user to
      enter two numbers and an option. The options are

      1. +
      2. -
      3. *
      4. /
        You should print an appropriate error message if the user enters invalid operator. Use switch statement in your program.

      Answer -: https://drive.google.com/open?id=1Osup1sSG3x60JDWd1aH9v4ked5Z8fsk0


      Question 2 -: An online retailer sells five different products whose retail prices are shown in the following
      table:

      Product number  Retail price
            1            2.98
            2            4.50
            3            9.98
            4            4.49
            5            6.87
      

      Write a C program that reads the following:

      1. Product number
      2. Quantity sold for one day
        Your program should use a switch statement to determine the total retail price for each product.

      Answer -: https://drive.google.com/open?id=1f6ZZkLNwYe0Qds8EHzsIHxX_rayfcSzU


      Question 3 -: Write a C program that compute the area of a square (area=side*2 ) or a triangle
      (area=base*height/2) after prompting the user to type the first character of the shape (S or T).

      1. Write the program using if-else statements
      2. Write the program using switch statement.
      3. Modify the program to find the area of a circle when the Letter “C” is entered.
      4. Modify the program to print an error message when the user enters an invalid
        character.

      Answer -: https://drive.google.com/open?id=1p2O7iIWCV4uRF1eR7_6dYz0gkm2i-RTR


      • මූලාශ්‍ර -: https://beginnersbook.com/2014/01/switch-case-statements-in-c/

      • C programm එකක් windows වල run කරන විදිහ --> https://bit.ly/2O6rLXR

      ඔබට අවශ්‍යනම් ඔබේ බ්‍රව්සර් එක හරහා online C programms run කරන්න පුලුවන්. එහෙම කරන්න පුලුවන් ලින්ක්ස් මන් පහතින් දාන්නම්

      • https://www.onlinegdb.com/online_c_compiler
      • https://www.tutorialspoint.com/compile_c_online.php
      • https://repl.it/languages/c

      සරලව මුල ඉදන් C programming ඉගෙන ගන්න පුලුවන් හොදම site කිහිපයක් මන් දාන්නම්

      • https://www.geeksforgeeks.org/c-programming-language/
      • https://www.tutorialspoint.com/cprogramming/index.htm
        https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/

      web url කෙටි කරන්න lankadevelopers ලා හදපු එයාලගෙම සයිට් එකක් තියෙනවා. -> https://link.lankadevelopers.com/

      මගේ කලින් ලිපි

      • C Programming මුල සිට ඉගෙනගනිමු(part 1 - Introduction) -: https://link.lankadevelopers.com/4WpH
      • C Programming මුල සිට ඉගෙනගනිමු (part 2 - Variables) -: https://link.lankadevelopers.com/mXio
      • C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators) -: https://link.lankadevelopers.com/SHNt
      • C Programming මුල සිට ඉගෙනගනිමු (part 4 - Input & Output functions) -: https://link.lankadevelopers.com/2MNku
      • C Programming මුල සිට ඉගෙනගනිමු (part 5 - create simple applications) -: https://link.lankadevelopers.com/KUF6
      • C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 1)) -: https://link.lankadevelopers.com/8Xe71
      • C Programming මුල සිට ඉගෙනගනිමු (part 7 - Format Specifiers in C) -: https://link.lankadevelopers.com/761PT

      මන් ඊළග ලිපියෙන් කියලා දෙන්නම් Iterate(loops)statements ගැන . මගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.
      තව ලිපියකින් හම්බෙමු ජය වේවා.

      posted in Blogs
      Kalana
      Kalana
    • C Programming මුල සිට ඉගෙනගනිමු (part 10 - do-while loop)

      සුබ දවසක් වේවා ඔයාලට. කලින් ලිපියේ මන් while loop එක ගැන කතා කලා. අද මන් කතා කිරීමට බලාපොරොත්තු වෙන්නේ do-while loop ගැන. මෙම loop එක ගැන කතා කලොත් මෙහි කාර්‍යයද වන්නේ while loop එකේ කාර්‍ය්යම වේ. නමුත් මේ දෙකෙහි පොඩි වෙනසක් ති‍යෙනවා. ඒක ගැන මන් ඉදිරියට කතා කරන්නම්. තවද do-while loop එක තමයි අපි අඩු වශයෙන්ම භාවිතා කරන loop එක.
      පලමුව මන් මෙහි ආකෘතිය ගෙනහැර දක්වන්නම්

      do
      {
          //Statements 
          //Increment(++) or Decrement(--) operator
      }while(condition);
      

      මේ ආකෘතිය යොදා ගනිමින් 1 සිට 10 ට දක්වා ඇති සංඛ්‍යා diplay කරමු.

      #include <stdio.h>
      
      int main()
      {
          int i = 1;
          
          do
          {
              printf("%d ", i);
              i++;
          }while(i <= 10);
      
          return 0;
      }
      
      Output -: 1 2 3 4 5 6 7 8 9 10
      

      ඔබට පෙනෙනවා ඇති මෙම පිලිතුරම අපට ලැබුනා while loop එකක් භාවිතා කිරීමේදී(කලින් ලිපිය බලන්න) නමුත් do-while වල පොඩි විශේෂත්වයක් පවතිනවා. ඒ තමයි while(condition); වල ඇති condition එක පරීක්ෂා කිරීමට පෙර do එක තුල ඇති code එක run වීමයි. මන් එය පහත උදාහරණ දෙකෙන් පෙන්වන්නම්.

      while loop එකක් ක්‍රියා කරන ආකාරය

      #include <stdio.h>
      
      int main()
      {
          int i = 0;
      	
          while(i == 1)
          {
      	printf("Inside of the while loop");
          }
      	
          printf("Outside of the while loop");
      }
      
      Output -: Outside of the while loop
      
      • පලමුව අපි i වල අගය 0ට සමාන කලා. ඊට පස්සේ while එකේ condition එක බලද්දි අපගේ i වල වර්තමාන අගය 1ට සමාන නොවන නිසා while loop එක run නොවී ඒකෙන් එලියේ
        ඇති code එක run උනා.

      do-while loop එකක් ක්‍රියා කරන ආකාරය

      #include <stdio.h>
      
      int main()
      {
         int i = 0;
         
         do
         {
              printf("Inside of the do-while loop\n");
         }while(i==1);
         
         printf("Outside of the do-while loop");
      }
      
      Output -: Inside of the do-while loop
                Outside of the do-while loop
      
      • මෙහිදී ඔබට පෙනෙනවා while loop එක ආකරයෙන් නොව වෙනත් Output එකක් අපට ලැබුනා. මෙහිදී loop එක ඇතුලේ පිහිටි code එකත් run උනා. මෙයට හේතුව වන්නේ අප program එක run කල විට do-while loop එකේ මුලින්ම run උනේ do කොටසයි. condition එක අයිති කොටස පවතින්නේ අවසානයේ නිසා මෙම ක්‍රියාකාරිත්වය නිතර සිදු වේ. එම නිසා එක්වරක් loop එක ඇතුලේ ඇති code එක run වී condition එක පරීක්ෂා කරයි, එහිදී i වල වර්තමාන අගය වන 0 කිසිවිටකත් 1ට සමාන නොවන නිසා තවදුරටත් loop එක ක්‍රියා කිරීම නවතී. ඉන්පසු loop එකට පිටත ඇති code එක run වේ.

      while loop එකේදී කතා කල සියලුම දෑ මෙයටත් අදාල වන නිසා මන් තවදුරටත් මේ ගැන කතා කිරීමට බලාපොරොත්තු වන්නේ නෑ. ඔයාලට මන් ප්‍රශ්න කිහිපයක් දෙන්නම් කරලා බලන්න. එතකොට ඔයාලට තව තේරෙයි මේ ගැන.

      Question 1 -: write a C program to print 1 to 100 even numbers by using while loop.

      Question 2 -: Write a C programm to input marks of three subjects from keyboard and output the total mark and average mark using while loop.

      ඉහත දී ඇති ගැටලු දෙක මන් while loop වලදි විසදලා පෙන්නුවා ඒක බලාගෙන මේකත් කරලා බලන්න.


      • C programm එකක් windows වල run කරන විදිහ --> https://bit.ly/2O6rLXR

      ඔබට අවශ්‍යනම් ඔබේ බ්‍රව්සර් එක හරහා online C programms run කරන්න පුලුවන්. එහෙම කරන්න පුලුවන් ලින්ක්ස් මන් පහතින් දාන්නම්

      • https://www.onlinegdb.com/online_c_compiler
      • https://www.tutorialspoint.com/compile_c_online.php
      • https://repl.it/languages/c

      සරලව මුල ඉදන් C programming ඉගෙන ගන්න පුලුවන් හොදම site කිහිපයක් මන් දාන්නම්

      • https://www.geeksforgeeks.org/c-programming-language/
      • https://www.tutorialspoint.com/cprogramming/index.htm
      • https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/

      web url කෙටි කරන්න lankadevelopers ලා හදපු එයාලගෙම සයිට් එකක් තියෙනවා. -> https://link.lankadevelopers.com/

      මගේ කලින් ලිපි

      • C Programming මුල සිට ඉගෙනගනිමු(part 1 - Introduction) -: https://link.lankadevelopers.com/4WpH
      • C Programming මුල සිට ඉගෙනගනිමු (part 2 - Variables) -: https://link.lankadevelopers.com/mXio
      • C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators) -: https://link.lankadevelopers.com/SHNt
      • C Programming මුල සිට ඉගෙනගනිමු (part 4 - Input & Output functions) -: https://link.lankadevelopers.com/2MNku
      • C Programming මුල සිට ඉගෙනගනිමු (part 5 - create simple applications) -: https://link.lankadevelopers.com/KUF6
      • C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 1)) -: https://link.lankadevelopers.com/8Xe71
      • C Programming මුල සිට ඉගෙනගනිමු (part 7 - Format Specifiers in C) -: https://link.lankadevelopers.com/761PT
      • C Programming මුල සිට ඉගෙනගනිමු (part 8 - Switch Statement) -: https://link.lankadevelopers.com/7jncK
      • C Programming මුල සිට ඉගෙනගනිමු (part 9 - While loop) -: https://link.lankadevelopers.com/4TBV5

      මන් ඊළග ලිපියෙන් කියලා දෙන්නම් for loop එක ගැන . මගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.
      තව ලිපියකින් හම්බෙමු ජය වේවා.

      posted in Blogs
      Kalana
      Kalana
    • RE: ශ්‍රී ලංකාවට Google Crowdsource!

      Thanks for sharing this brother

      posted in Blogs
      Kalana
      Kalana
    • RE: ශ්‍රී ලංකාවේ wall arts ඔක්කොම එකම තැනකින්

      thanks for sharing bro

      posted in Blogs
      Kalana
      Kalana
    • RE: C Programming මුල සිට ඉගෙනගනිමු (part 16 - C functions)

      @root mee dawas tike assignments tikk watuna. Mn free una gmn danm.

      posted in Blogs
      Kalana
      Kalana
    • 1
    • 2
    • 2 / 2