@root said in [Guide] Online Passive Income By Blogging:
Thnx bro, keep it up
Sure thing mate 🔥
Pseudocode helps computer programmers in writing computer algorithms.
Pseudocode is a way of describing written instructions as a series of English-like sentences. It has a similar purpose to flowcharts - to describe the logic of a program.
pseudocode is often referred to as a syntactical representation of a program and it doesn't have a strict syntax since it only represents the way we're thinking so it should leave very little for the
Imagination So it's readable for most people
It’s important to understand that pseudocode is not a programming language.
it's actually a learning and reasoning tool used to help programmers understand and write code.
so it's language agnostic, it's something that you write that is not an actual code in any programming language but that if anyone were to read it it would be very clear to what is happening or what steps are being taken.
So what pseudocode actually enables us to do is to grab a simple set of instructions that are written in plain English and eventually translate that into a program that can be executed.
So hopefully this gave you a better understanding on what is pseudocode, how to write pseudocode and how to use it
Introduction
At times when developing applications, we may come across scenarios where the data sent to a server via http has to be verified to check whether the data has been manipulated when traveling across the wire to the server. This verification is required to check for the authenticity of the data.
Today, let us discuss about how to digitally sign data, often referred as DigitalSignature, and verify the DigitalSignature and data sent to a server using azure key-vault certificate and C#. This DigitalSignature can be then sent along with the data as a part of the request header or by other means according to the usage.
Keywords
DigitalSignature – the data that’s digitally signed using a certificate
Data – the message or document sent to a server via http post request most often
Azure key-vault – a service provider in the cloud that provides a secure store for secrets.
Read more on azure key-vault at
https://azure.microsoft.com/en-us/services/key-vault/
Pre-requisites
• Have some basic understanding about azure
• Understanding of asymmetric cryptography
• Working knowledge in C#
• Azure subscription
1. Setting up an Azure key-vault certificate
In this section lets us create a certificate on azure key vault.
First, create an azure key-vault resource, if you already have a Key-Vault resource you can use it.
In the left menu, under the “Settings” section select “Certificates”.

Once navigated to the certificate section, click on “Generate/Import”
The above action will take you to the page where it allows you to create or import a new certificate. Since we are creating a new certificate, select “Generate” from the “Method of Certificate Create” dropdown, and fill in the fields. Most of them can be left to the defaults selected. DON’T click on Create yet.

Once you come to the bottom of the form, click for the highlighted section as shown in above image. This will open a side bar to configure the policies. Please make sure that you select the required policies from the drop down as you cannot change them once the certificate is created. As for this certificate, we need the “Digital Signature” selected under “X.509 Key Usage Flags”.

In addition, please check all the flags in order to avoid problems from other features that may be required. You can also select the “Key Size” according to your need.
Finally, click “Ok”, and click on create button. This will create the certificate and it will take few minutes for the certificate to enable.
2. Configuring Access to Azure Key-Vault Using Active Directory
In order to use the certificate for signing and verifying the signed data from code we need to be authenticated in order to access the certificate.
In this section let’s understand how to configure an Active Directory app to access the certificate from code.
• Create an Active Directory app
Go to “Azure Active Directory” in the azure portal menu.
Select “App Registrations”, then click on “New registration” to add a new application providing a meaningful name.

Once the app has been created it will appear in the list as below. Copy the Application (Client) ID as it is required in the future.
Now navigate into the application details by clicking in the name of the app to generate a client secret. Click on the “Certificates and secrets” and then click on “+ New Client Secret”
Once the client secret is generated copy and have it pasted in a secure place along with the Application (Client) Id
Now navigate back to the azure key-vault resource that you created and click on “Access Policies”, then click on “Add Access Policy”.
This will take you to the “Add access policy” page to setup access policies.
Now let’s configure policies.
• From the “Configure from template (optional)”, select the highlighted ones according preference.

• Similarly select the “key permissions”, “secret permissions” and “certificate permissions” accordingly. As in this case it has to be “certificate permissions”.
• From the “Select Principal”, select the name of the Application that we registered with Active Directory. In case the app doesn’t appear in the list, search the name of the application that was used to register with Active Directory.

In this case the name of my Active Directory Application is “CFS-key-vault’. Select the proper application and click on “Add”.
Now this application’s Client-Id and Client-Secret can be used to access the certificate, sign and verify data from code.
3. Connecting to Key-Vault From Code
In this section let’s connect to the azure key-vault using the KeyVaultClient which is in the namespace Microsoft.Azure.KeyVault. The name space is also available as a nuget package at [https://www.nuget.org/packages/Microsoft.Azure.KeyVault/](link url)
Let’s look at the code
public KeyVaultClient GetAzureKeyVaultClientInstance() { var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(AuthenticateClient)); return keyVaultClient; } private async Task<string> AuthenticateClient(string authority, string resource, string scope) { var clientCredential = new ClientCredential("<your active directory application (client) Id>", "<the client Secret of the active directory app>"); var authenticationContext = new AuthenticationContext(authority); var result = await authenticationContext.AcquireTokenAsync(resource, clientCredential); return result.AccessToken; }• In the above code, the method GetAzureKeyVaultClientInstance(), returns an instance of a KeyVaultClient once the authentication is successful.
• The KeyVaultClient constructor takes in an instance of the KeyVaultClient.AuthenticationCallback() delegate as a constructor parameter which has a callback function AuthenticateClient.
• The private method AuthenticateClient() takes in three arguments as shown in the code.
• You must pass the active directory application client Id and client secret as parameters to the ClientCredential instance as constructor parameters in the private method AuthenticateClient().
• The rest of the code is self-explanatory.
• If the authentication is successful the GetAzureKeyVaultClientInstance() method will return an instance of a KeyVaultClient, else it will throw unauthorized exception.
• Now that we have an instance of the KeyVaultClient, we can use it to sign and verify signed data.
4. Signing and Verifying Signed data using the certificate
In this section lets he how to sign and get the signed data verified using the certificate in azure key-vault.
• Let us first sign data using the certificate.
Let’s walk through the code below
public async Task<ValueTuple<byte[], string, byte[]>> GetSignedResultAsync(string model) { try { var encodedToBytes = Encoding.UTF8.GetBytes(model); var digest = Hasher.GetSHA256Digest(encodedToBytes); using (var keyVaultClientInstance = azureKeyVaultClient.GetAzureKeyVaultClientInstance()) { var signedData = await keyVaultClientInstance .SignAsync(keyIdentifier: "<your azure key vault certificate key identifier>", algorithm: JsonWebKeySignatureAlgorithm.RS256, digest: digest); return (signedData.Result, signedData.Kid, digest); } } catch (Exception e) { throw new OperationFailedException("some error message"); } } The method GetSignedResultAsync() takes in string parameter which is a JSON serialized representation of the data intended to sign. The serialized JSON is the encoded using the Encoding which is in the namespace System.Text. Here in this example I have used UTF8, you can use other options as well. Then the encodedToByte variable is passed to a hashing function. In this case SHA256 which will return a hashed value which is referred to as a digest. Then in the using statement we can make use of the KeyVaultClient instance that was return after authorization to the azure key-vault. In the above code I have used a function to get an instance of the KeyVaultClient. Since the KeyVaultClient instance implements the IDisposable interface it is wrapped in a using statement. Now on the KeyVaultClient instance we can invoke the SignAsync() method on it. Go to you key vault resource. Click on “certificate” in the left blade, then navigate to a certificate you are interested in.

From here navigate into the certificate version.


Now, scroll down to the bottom of the page to get the key identifier of the certificate
• The green highlighted area provides key identifier. Copy the key-identifier and past it for the keyIdentifier argument of the SignAsync() of the KeyVaultClient instance.
Now, pass the algorithm and digest as the second and third arguments of the SignAsync() method respectively. The SignAsync() will return a KeyOperationResult which has a property Result it. This Result is the DigitalSignature that was signed by the certificate in azure key-vault.
• Now we can verify the digital signature against the original model. Let’s see how.
Lets walk through the code snippet below
• First, we need an instance of KeyVaultClient class. You can follow the steps explained above to get this done.
• VerifySignedResultAsync() takes in 3 arguments.
• The KeyVaultClient instance has a method VerifyAsync() which will take in the arguments passed to the VerifySignedResultAsync() method and the key identifier of the certificate. The VerifyAsync() will return a Boolean true if the signed data and the digest match, else will return false.
That’s it. Hope you have had a better understanding on how to sign and verify signed data and are able to apply to your application when needed.
Thanks.
alt text
Would you believe if I tell you that you can get paid Udemy courses for free using a 100% legit method? Today I will be guiding you through a 100% legit method on how to get Udemy paid courses for free with lifetime access including a free certification from Udemy, after completing a course.
Learn new skills with Udemy using free promo codes and get a professional certificate to showcase your skills.
In this quick 1 minute tutorial, I will show you How to Bypass ADF.LY "Please press allow to Continue" and get your links delivered safely to you.
alt text
In this quick tutorial, I will guide you on how to download and activate Microsoft Office 365 without using any cracking software.
This method is 100% legit and working perfectly. Watch the full video for Zero Errors.
Thanks for Watching!
Like, Subscribe and Stay Connected
MS Access යනු Microsoft Office තුල තිබෙන වැදගත් මෘදුකාංගයක් කියලා ඔයාලා දන්නවනේ. කාර්යාලීය කටයුතු පහසු කිරීමට Word හා Excel වගේම මේ මෘදුකාංගයත් ගොඩක් උදව් වෙනවා. ඉතින් ඒ නිසා Access ඉගෙනගන්නට කැමති ඔයාලා වෙනුවෙන්මයි සිංහලෙන්ම කරපු මේ Tutorial Series එක.
01 - Introduction to MS Access
02 - Table Creation
03 - Tables & Relationships
04 - Designing Queries
05 - Form Designing
06 - Report Creation
තාක්ෂණයට සම්බන්ධ මේ වගේ වැදගත් වීඩියෝ බලන්න කැමතිනම්, අපේ youtube channel එක subscribe කරලා අපිට පොඩි support එකක් දෙන්නත් අමතක කරන්න එපා ❤
✅ Like ✅ Share ✅ Comment & Stay Connected!
How I downloaded 100GB using LKR 200 including the Best Tips to use a Time Based Package more effectively in Sri Lanka 😎
✅ Video Link | https://youtu.be/m255qisSxwk
If you find this video useful, please don't forget to subscribe our channel ❤
MS Access සිංහලෙන් 🔥
Complete Tutorial Series ❤
01 - Introduction to MS Access
https://youtu.be/wsF2L3spsIU
02 - Table Creation
https://youtu.be/fY3DI7QSd9g
03 - Tables & Relationships
https://youtu.be/qmMUFPUa6QY
04 - Designing Queries
https://youtu.be/THLpaG4BnEA
05 - Form Designing
https://youtu.be/DAg2cJtRO5I
06 - Report Creation
https://youtu.be/BmoMJYGHFSY
වටිනවා කියලා හිතෙනවානම් අපේ youtube channel එක subscribe කරලා යාලුවන්ටත් share කරන්න අමතකකරන්න එපා ❤
In this video, I will be guiding you through a 100% legit method on How to get paid Udemy Courses for Free with Lifetime Access including a Free Course Certification from Udemy.
Learn from Paid Udemy courses for free using promo codes and get a professional certificate to showcase your ability!
✅ Video Link | https://youtu.be/r36KjDsNUjs
A few days ago AWS launched its newest service, Amazon Honeycode.
The main purpose of this service is to allow users to build web and mobile apps without writing code. This no-code environment is built around an interface that’s similar to a spreadsheet.
According to Jeff Barr (an Amazon Web Services (AWS) executive), if you’re familiar with spreadsheets and formulas already this a golden opportunity for you because many options, like sheets, tables, values, and formulas, can also be applied in Honeycode.
Honeycode comes with a variety of templates for some common applications, to help users to get started with things quickly. These include to-do lists, customer trackers, simple surveys, inventory management, content trackers, time-off reporting, event management, team task trackers, and time off reporting. These template apps are easily customizable and can be deployed quickly.
Although it is too early to compare Honeycode with any other products with similar features, we can expect some exciting features ahead as the honeycode journey continues. Personally, I hope they add features to focus more on user experience and designs.
Tired of slow internet speed while downloading torrent files?
In this video, I will be guiding you with the best way to increase the downloading speed of a torrent file. Also, this method is helpful when downloading torrents with a lower number of seeders.
ඕනෙම torrent file එකක් සුපිරිම සුපිරි හිතාගන්නබැරි වේගෙන් download කරගන්න විදිය.
✅ Video Link | https://youtu.be/-tUft8JNPns
Software engineering term is very popular nowadays mostly due to the rapid digitization of classic businesses. A well known example for digitization of businesses could be marketplaces; one or two decades back we had old fashioned markets with hand written invoices after each payment with a bunch of coins and notes. But now we have digitally printed invoices with card payments, bonus systems, even virtual shopping/online shopping and online orders thanks to computer software.
What is software and engineering
A computer software is basically a collection of instructions which instructs computers for a specific purpose or goal. Indeed, it has some documentation which is usually composed by technical writers in order to explain its users about the usage of that piece of software. Following things can be classified into modern computer software.
Operating systems, embedded systems and utilities. Web applications (type of software that will run on a server computer and/or on client computers) Mobile applications Desktop applicationsThere is a specific life cycle or development workflow for above things. We call it Software Development Life-Cycle (also known as SDLC). Indeed, the application of engineering practices such as planning, designing, building and testing with SDLC for the development of computer software can be identified as software engineering. In simple words; software engineering is an engineering process of building/managing computer software.
Software engineering in Sri Lanka
As mentioned at the very first Sri Lankan software engineering industry got a huge push with the digitization of businesses and a lot of new software companies selected their desired field in business transformation such as manufacturing, medicine and education. Thereafter, some companies started creating tools or building boxes which will be used in software development by other companies or individuals. Also, some IT firms around the world (specially from countries such as the USA) established their development centers in Sri Lanka.
Types of IT companies in Sri Lanka
Standard/traditional service based companiesThese types of companies have an organizational structure which is very similar to other non-IT companies. They offer software engineering as a service for other countries or for Sri Lankan businesses. workload is very flexible/manageable and importantly these type of companies are highly stable with a 100–500 total employee count.
Many people try to settle at these kinds of companies considering the long term employee benefits and work-life balance.
Product based companies usually resell a software product or set of software products with some customization for various clients around the world. Workload can be bit more than usual because the same engineering team may work with the product upgrades and the customization/reselling process. These type of companies are also stable with a 100–500 total employee count.
Medium-sized IT firms (service/product based or mixed)These types of companies can be either service based or product based, or a combination of both. They are having 20–100 employees and can be considered as a mid-range company according to the employee count. Workload can be kind of varying due to the organizational changes.
4. Startups
Sri Lanka’s startup culture is not like Silicon Valley yet but mostly well experienced retired software developers are establishing startups perhaps with the support of foreign connections. Future success of these types of companies will depend on the business strategy and the growth of the targeted market of their software product or services.
Workload can be more than usual due to the limited number of employees or due to closer deadlines but joining with a startup will bring you a lot of experience and also great exposure to modern technology stacks. Employee count is normally around 20 at initial stages.
Job opportunities
Sri Lankan software engineering industry is growing rapidly and there are lot of opportunities for newcomers. Indeed, this industry has a high salary scale compared to the other types of employment in Sri Lanka. If someone has a passion to become a programmer and also needs to get a high salary even in the beginning, becoming a software engineer is a wise choice. Anyone could become a software engineer somehow, whereas getting a job in type 1) , 2) company could be bit challenging because they are good in all aspects (such as compensation, reputation and job security)
Ideas about future
Due to the trend of software engineering culture in Sri Lanka many people will try to start their career as programmers. It is good but on the other hand the hiring process will be somewhat challenging for the Sri Lankan companies in near future.
Original article copied from https://softwareengineer.lk/
Unicode නොවන, එහෙමත් නැත්තම් Photoshop සහ designing සඳහා පාවිච්චි කරන decorative සිංහල fonts ටයිප් කරන්නෙ කොහොමද කියන එක අපි ගොඩ දෙනෙක්ට තියෙන ලොකු ප්රශ්නයක් ⚠
ඉතින් ඒ ප්රශ්නෙට මට හොයාගන්න පුලුවන් උන හොඳම solution එක ඔයාලත් ගොඩක් වැදගත්වෙයි කියලා හිතනවා.
Try කරලා බලන්න 💙
✅ Video Link | https://youtu.be/7TWO_fjwC-M
In this video, I will be guiding you through simple steps to convert any file to any other different file formats by using few seconds.
අවශ්ය ඕනෑම file එකක් තප්පර කිහිපයකින්, තවත් file format එකකට convert කරගන්න විදිය 🔥
File Conversions Include:
➤ Any file to any Video type conversions
➤ Any file to any Audio type conversions
➤ Any file to any Picture type conversions
➤ Any file to any Document type conversions
and many more interesting features.
✅ Video Link | https://youtu.be/7Rvs_WPZPsk
Pixabay : Photos, Videos, Vectors, Illustrations
Pexels : Photos, Videos
Unsplash : Photos, Wallpapers, Textures, Patterns
Life of Pix : Photos, Videos
Gratisography : Photos
Negative Space : Photos
Splitshire : Photos, Videos
Burst : Photos
Rawpixel : Photos, Vectors, Frames, Templates, Mockups, Graphics
Picjumbo : Photos, Wallpapers, Abstract images, Mockups
Moose Stock Photos : Photos, Collages, Memes, Icons, Vectors, Audio
Avopix : Photos, Vectors, Videos
ISO Republic : Photos, Videos
Stockvault : Photos, Vectors, Illustrations, Textures
Dreamstime : Photos, Videos, Audio
FancyCrave : Photos
Death to Stock : Photos, Videos
Travel Coffee Book : Photos
Free Media Goo : Photos, Textures, Videos, Backgrounds
Free Nature Stock : Photos
Freepik : Photos, Textures, Icons, PSDs, Vectors, Portraits
IM Free : Photos, Icons, Templates
New Old Stock : Photos, Videos, Vectors, Templates
Space X Photos : Space X Photos
Jeshoots : Photos, PSDs
Wikimedia Commons : Photos, Videos, Audio
123RF : Photos, Vectors, Videos, Music
AllTheFreeStock : Photos, Videos, Music, Icons
Public Domain Review : Photos, Films, Music, Books
Pickup Image : Photos, Clipart
Ultra HD Wallpapers : Photos, Wallpapers
සුබ දවසක් වේවා ඔයාලට. කලින් ලිපියේ මන් do-while loop එක ගැන කතා කලා. අද මන් කතා කිරීමට බලාපොරොත්තු වෙන්නේ for loop එක ගැන. මෙම loop එකෙන් කරන්නේද් අනිත් loop වර්ග දෙකෙන් කරන කාර්යයම වේ. මෙහි ක්රියාකාරිත්වය වැඩි වශ්යෙන් සමාන වන්නේ while loop එකේ ක්රියාකාරිත්වයටයි. සාමාන්යයෙන් loop වලින් වැඩි වශයෙන් අප භාවිතා කරන loop එක වන්නේද for loop එකයි. පලමුව මන් මෙහි ආකෘතිය ගෙනහැර දක්වන්නම්.
for (initialization; condition test; increment or decrement) { //Statements to be executed repeatedly }මන් ඉහත ආකෘතිය උදාහරණයක් මගින් පැහැදිලි කරන්නම්. අපි මේ ආකෘතිය යොදා ගනිමින් 1 සිට 10 ට දක්වා ඇති සංඛ්යා diplay කරමු.
#include <stdio.h> int main() { int i; for (i = 1 ; i <= 10 ; i++) { printf("%d ", i); } return 0; } Output -: 1 2 3 4 5 6 7 8 9 10ඉහත උදාහරණයෙන් ඔබට පෙනෙනවා ඇති while loop එකේදී අපි තැන තැන භාවිතා කල සියලු loop එකට අදාල කොටස් for loop එකේදී එක තැනකට ඇවිත් ඇති බව. මෙය මූලික ආකෘතිය වුවත් මෙය භාවිතා කල හැකි අනු ආකෘති කිහිපයක් පවතිනවා. එනම්
i++ වෙනුවට i = i + 1 භාවිතා කල හැකිය. for (i = 1 ; i <= 10 ; i = i + 1) { printf("%d ", i); } for loop එකේ i වල අගය විශේෂණය කර ඇති කොටස එනම් i = 1 කියන කොටස for loop එක එලියෙන් මෙසේ ලිවිය හැකිය. නමුත් ; ලකුණ තිබෙන පරිදි තිබීමට දිය යුතුය. int i = 1; for ( ; i <= 10 ; i++) { printf("%d ", i); } i++ හෙවත් i වල අගය ඉදිරියට ගෙනියන code එක අපට for loop එක ඇතුලත් ඕනෑම තැනක යෙදීමට පුලුවන් වේ. මෙහිද ; ලකුණ තිබෙන පරිදි තිබීමට දිය යුතුය. for (i = 1 ; i <= 10 ; ) { printf("%d ", i); i++; } i = 1 කොටස හා i++ යන කොටස් දෙකම for එක තුලින් ඉවත් කොට while loop ආකෘතිය මෙන් ලිවීමට හැකියාව ඇත. int i = 1; for ( ; i <= 10 ; ) { printf("%d ", i); i++; } i++ විතරක් නොව i වල අගය අඩු කල හැකි i-- ද අපට for loop එකක භාවිතා කල හැකිය. for (i = 10 ; i >= 1 ; i--) { printf("%d ", i); } Output -: 10 9 8 7 6 5 4 3 2 1මේකෙදිත් මන් ඔයාලට ප්රශ්න දීමට බලාපොරොත්තු වෙන්නේ නෑ. මොකද while loop ලිපියේ දීපු ප්රශ්න මේකෙදිත් ඔයාලට කරන්න පුලුවන් නිසා. ඒ උණත් මන් for loop එකට ආවේණික ප්රශ්න කිහිපයක් කරන්නම්.
Question -: Write a C program to print below format using for loops.
******* ******* ******* *******for loop කිහිපයක් යොදා ගනිමින් ඉහත හැඩතලය නිරූපණය කරන program එකක් code කරන්න කියලා අපට කියනවා. අපි මෙය පියවර වශයෙන් පැහැදිලි කරගම්මු.
අපි පලමුව මෙම මුළු හැඩතලයෙන් කොටසක් එනම් පලමු පේලිය(*******) පමණක් for loop එකක් මගින් output කරමු . #include <stdio.h> int main() { int i; for(i = 1 ; i <= 7 ; i++) { printf("*"); } return 0; } Output -: ******* ඔබට පෙනෙනවා ඇති එක for loop එකක් මගින් එක් පේලියක් කැමති තරු ගණනකින් පිරවිය හැකි බව. නමුත් අපට අවශ්ය වන්නේ ඒ වගේ පේලි 4ක් වේ. තරු 7ක් Output කරන්න එක් for loopතීරු ගණන වන තීරු 7 ඉහත for loop එක මගින් අප අරගෙන ඉවර නිසා පේලි 4 ගන්න විදිහ දැන් බලමු.
තීරු -: columns පේලි -: raws #include <stdio.h> int main() { int raw; //පේලි ගණන නිරූපණය කරන variable එක int col; //තීරු ගණන නිරූපණය කරන variable එක for(raw = 1 ; raw <= 4 ; raw++) //පේලි 4ක් print කිරීමට යොදා ගනී. { for(col = 1 ; col <= 7 ; col++) // තීරු 7ක් එනම් තරු 7 print කිරීමට යොදා ගනී { printf("*"); } printf("\n"); //තීරු 7ක් එනම් තරු 7ක් print වීමෙන් අනතුරුව ඉතුරු තරු 7 ඒවා පහලින් පහලට print කිරීමට මෙය යොදා ගනී. } return 0; } Output -:******* ******* ******* *******ඔයාලට තරු රටා පිලිබද වැඩි දුරටත් ඉගෙන ගන්න ඕනනම් මන් ලින්ක් කිහිපයක් දාන්නම් නැත්තම් Google search bar එකට ගිහින් star patterns in C කියලා search කරන්න.
Link1 -: https://codeforwin.org/2015/07/star-patterns-program-in-c.html
Link2 -: https://www.programiz.com/c-programming/examples/pyramid-pattern
Link3 -: https://www.programmingsimplified.com/c-program-print-stars-pyramid
මන් ඔයාලට සරල වගේම ටිකක් සංකීර්ණ ගැටලු කිහිපයක් දෙන්නම්, නිකන් ඉන්න වෙලාවට කරලා බලන්න.
Question 1 -: Write for statements that print the following sequence of values:
a) 3, 8, 13, 18, 23 b) 20, 14, 8, 2, -4, -10 c) 19, 27, 35, 43, 51answer for a -: https://drive.google.com/open?id=1hT_MzDFb7UBIscO1UpGnFXtPbykzjHH2
answer for b -: https://drive.google.com/open?id=1PAuJdwDuWA1_VflDKTaNLW_hLax-Poeg
answer for c -: https://drive.google.com/open?id=1HpibNCAQ7lV-Ed-OAt8pm_ktvGjWLIxl
Question 2 -: Write a C program using for loops to display the following pattern on the screen
* ** *** **** ***** ****** ******* ******* ***** *** *answer -: https://drive.google.com/open?id=147j8QuV7y-tSYNKTsRGkSoIq1ADAvWgU
Question 3 -: Calculate the value of pie(3.14) from the infinite series
= 4 − 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ....Print a table that shows the value of pie approximated by one term of this series, by two terms, by
three terms, and so on. How many terms of this series do you have to use to get 3.14159?
answer -: https://drive.google.com/open?id=1AC1XYfbCRTj3PU5NPZjkiDC1MUj5mNmZ
Question 4 -: The factorial of a nonnegative integer n is written n! and is defined as follows:
n! = n * (n-1) * (n-2) * ……1and
n! = 1 (for n =0)For example, 5! = 5 * 4 * 3 * 2 * 1, which is 120
Write a C program that reads a nonnegative integer and computes and print its factorial using a
for loop.
answer -: https://drive.google.com/open?id=1Pjo-p8CKhgnJ5WxuM6naT2El-mJ3pjpX
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 C Programming මුල සිට ඉගෙනගනිමු (part 10 - do-while loop) -: https://link.lankadevelopers.com/4WcNdමන් ඊළග ලිපියෙන් කියලා දෙන්නම් arrays ගැන . මගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.
තව ලිපියකින් හම්බෙමු ජය වේවා.
A-EP22-Remote-Work.jpg
ඉතින් වැඩක් හොයාගන්න බැරිතරම් දැනට ලෝකයේම තත්වය ඉතාමත් නරක අතට හැරෙමින් තියෙන වෙලාවක, අපි කොහොමද වැඩක් හොයාග්නනේ කියලා දැන ගන්න එක ඉතාමත්ම කාලෝචිතයි කියලා මම හිතනවා. ඉතින් මම දැම්ම මම කොහොමද මේ අභියෝගය ජයගත්තේ කියලා. මේ තියෙන්නේ ඒ වීඩියෝව.... වටින කෙනෙක් පහළ ලින්ක් එකෙන් ගිහිල්ලා ඒක බලන්න. ජය වේවා. පරිස්සමට ඉන්න.
මේ කතාව 70 දශකය දක්වා දිවයන කතාවක්! ඉතින් ඉස්සෙල්ලාම Linux වල ඉතිහාසයට කලින් අපි unix ගැන කතා කරලා ඉමු.
70 දශකය පටන් ගන්නවාත් එක්කම ඇමරිකාවේ මැසචුසෙට් සමාගම හා bell labs සමාගම එකතු වෙලා අලුත් ව්යාපෘතියක් පටන් ගත්තා.මේ ව්යාපෘතිය තමා අලුත්ම OS එකක් නිර්මාණය කරන එක.ඉතින් මේකේ නම උනේ Multics(Multiplexed Information and Computing Service). නමුත් අවාසනාවකට මේ ව්යාපෘතිය වානිජ මට්ටමින් සාර්ථක උනේ නෑ. ඒ නිසා මේ ව්යාපෘතිය අතෑරලා දාන්න මේ පරීක්ෂකයන්ට සිදු උනා.
ඉතින් මේ ව්යාපෘතිය වෙනුවෙන් bell labs එකේ වැඩ කරපු කෙන් තොම්සන් ට ඕනේ උනා පරිඝණක ක්රීඩාවක් ක්රීඩා කරන්න ඉතින් මේ අදහස හින්දාම තොම්සන් space travel කියන පරිඝණක ක්රීඩාව නිර්මාණය කලා.ඒත් මේ game එක ඒ කාලේ තිබ්බ mainframe computers වල ඉතාමත් හෙමින් තමා ක්රියාත්මක උනේ. මේකට විසදුමක් විදිහට තමා 1969 වෙද්දී කෙන් තොම්සන් අලුත් මෙහෙයුම් පද්දතියක් නිර්මාණය කරන්නේ.
මේ කටයුතු කරන්න කෙන් තොම්සන් එක්ක තවත් කෙනෙක් සම්බන්ධ වුනා ඔහු DEC(Digital Equipment Corporation) සමාගමේ මෘදුකාංග නිර්මාණය කරමින් සිටි ඩෙනිස් රිචී. පසුකාලීනව C programming language එක නිර්මාණය කරන්නත් මූලිකත්වය ගන්නෙත් මෙතුමාම තමා.
ඊටපස්සේ මේ දෙන්නා එකතු වෙලා PD7 පරිඝණක වලට ගැලපෙන විදිහට අර OS එකේ code එක වෙනස් කරේ space travel game එක හොදට ක්රියාත්මක කරන්න.
මෙතනදී බ්රයන් කර්නිගන් කියන පරිඝණක ශිල්පියා තමා PD7 පරිඝණක පිලිබඳ අදහස ඉදිරිපත් කරන්නේ.ඒ වගේම තමා UNIX කියන නම ඉදිරිපත් කරන්නෙත් ඔහුමයි.1971දී UNIX නාමය නිල වශයෙන් පිලිගත් අතර 1973 වෙද්දී UNIX OS එක C language එක යොදාගෙන නැවත ප්රතිනිර්මාණය කරා.
ඉතින් මේ විදිහට ප්රසිද්ද උන UNIX OS ගැන ඉතුරු විස්තර ඊලග කොටසින් අරන් එනකන් සුභ දවසක්!
සුබ දවසක් වේවා ඔයාලට. අද මන් කතා කිරීමට බලාපොරොත්තු වන්නේ C programming වල එන ඉතා වැදගත් අංගයක් වන functions ගැනයි. අපි බලමු මොනාද මේ functions කියන්නේ කියලා.
ඔයාලා හිතන්න මෙහෙම ඔයාලගේ ගෙදර සේරම බල්බ් ටික පත්තු වෙන්නේ එක ස්විච් එකකින් කියලා. බැලූ බැල්මට වැඩේ ලේසියි වගේ පෙනුනට එක ස්විච් එකකින් බල්බ් එකක් පත්තු කරනවා කියන්නේ ප්රශ්න රැසකට මුහුණ දෙන වැඩක් එක බල්බ් එක කැඩුනොත් සේරම වයර් චෙක් කරන්න ඕනා. අනෙක් අතට බල්බ් ගොඩක් වැඩ කරන්නෙත් නැතුව යනවා මේ වැඩේ නිසා.
නමුත් හිතන්න හැම බල්බ් එකකටම එක ස්විච් එක ගානේ තියෙනවා කියලා. මෙහෙම උනොත් බල්බ් එකක් වැඩ කරන්නේ නැතිව ගියොත් අනිත් බල්බ් වලට ප්රශ්නයක් නෑ. ඒ වගේම මොන බල්බ් එකද වැඩ කරන්නේ නැත්තේ කියලා අපිට කෙලින්ම කියන්න පුලුවන්.
අපි මේ දක්වා අපේ program කරන් ආවේ ඔය මන් කිව්ව පලවෙනි ක්රමේට. සේරම වැඩ කරන්නේ එක ස්විච් එකකින් එනම් සේරම තියෙන්නේ int main() එක ඇතුලේ. එක පේලියක් වැඩ කලේ නැත්තම් සේරම අවුල් යනවා ඒ හින්දා එම අවුල් ජාලය වලක්වන්න තමා අපි functions ඔයාලට හදුන්වා දෙන්නේ. int main() එකේ run වෙන්න ඕන ගොඩක් codes අපි ලබා දෙන functions ඔස්සේ run අවසන් පිලිතුර int main() එකට ලබා දීම මෙම functions සිදු කරයි.
සරලව කිව්වොත් functions වලින් කරන්නේ අපිට ලබා දුන්නු වැඩ ප්රමාණය කොටස් වලට බෙදාගෙන එම භාරගත් කොටස් ඉවර කොට නැවතත් main() එකට ලබා දෙන එකයි.
අපි බලමු functions වල අකෘතිය කොයි වගේද කියලා
#include <stdio.h> <return_type> <function_name>; int main() { printf("Hello World"); return 0; } <return_type> <function_name> (<argument list>) { //Set of statements – Block of code }<return_type> -: return_type කියලා කියන්නේ අපි variables හඳුන්වන්න ගන්න data type වලටයි. එනම්
int, float, char, short,..., etc -: return එකක් අනිවාර්යයෙන් තිබිය යුතුය.
void -: return එකක් නොතිබිය යුතුය.
<function_name> -: function name සඳහා අපිට කැමති නමක් භාවිතා කල හැකිය හරියට variable name එකක් භාවිතා කරනවා වගේ.
<argument list> -: argument list වලදී අපි අපේ variable එකත් එක්ක එයට අදාල data type එකත් දැක්විය යුතුය.
int, float, char, short,..., etc වලදී argument list අනිවාර්යයෙන් තිබිය යුතු අතර
void වලදී argument list අනිවාර්යය නොවේ.
උදාහරණ -:
int sum(int num1, int num2) { //codes return; } void sum() { //codes }මන් දැන් සරල C program එකක් function එකක් යොදගෙන කරන්නම්. එතකොට ඔයාලට තේරෙයි මන් කිව්වේ මොනාද කියලා.
1. write a c program to input two numbers from key board and get sum of them using function.
මෙහිදී කියන්නේ function භාවිතා කර ඉලක්කම් දෙකක එකතුවක් ලබා ගන්නා ලෙසයි.
#include <stdio.h> int sum(int, int); //sum කියන function එක තුල ඇත්තේ int වර්ගයේ variable බව මෙතනින් පැහැදිලි කරයි. int main() { int num1 = 5; int num2 = 6; int total = 0; total = sum(num1, num2); //මෙතන සත්ය වශයෙන්ම් ඇත්තේ sum(5, 6) යන්නයි. මෙම අගයන් දෙක int sum(int number1, int number2) වලට ලබා දී එහි ඇති return මඟින් පිලිතුර මෙයට නැවත ලබා ගනී. printf("Total is = %d", total); අවසන් පිලිතුර output වේ. return 0; } int sum(int number1, int number2)// sum(num1, num2) හි ඇති සංඛ්යා දෙක වන 5 සහ 6 මෙතනට පැමිණ number1ට හා number2ට ආදේශ වේ. { return (number1 + number2); //ආදේශ වූ පසු 5 හ 6 එකට එකතු වී එකතුව වන 11 කියන අගය sum(num1, num2); දක්වා ගෙන ගොස් එයට ලබා දේ. }Output -:
Total is = 11මෙම ගැටළුව කල හැකි තව ආකාරයක් බලමු.
#include <stdio.h> int sum(); //int sum() එක තුල argument කිසිවක් නොමැති නිසා මේ ආකාරයෙන් ලියයි. int main() { int total = 0; total = sum(); //මෙහිදී sum() මඟින් int sum() function එක ක්රියාකරවන් අතර අවසන් පිලිතුර return එකක් මඟින් පිලිතුර ලබාගෙන එය total එකට ලබා දේ. printf("Total is = %d", total); return 0; } int sum() { int num1 = 5; int num2 = 6; return (num1 + num2); }Output -:
Total is = 11අපි දැන් void යොදා ගෙන මෙම ගැටළුව විසදමු.
#include <stdio.h> void sum(int, int); int main() { int num1 = 5; int num2 = 6; sum(num1, num2); // මෙහිදී 5 හා 6 කියන ඉලක්කම් num1හා num2 වලට ආදේශ වී void sum(int number1, int number2) කියන function එක ක්රියාකරවා අවසන් පිලිතුර අපට ලබා දේ. return 0; } void sum(int number1, int number2) { int total = 0; total = number1 + number2; printf("Total is = %d", total); //ඔබට පෙනෙනවා ඇති void සඳහා return අවස්තාවක් නොමැති බව. }Output -:
Total is = 11අපි දැන් void යොදාගෙන තව ආකාරයකට මෙය විසඳමු.
#include <stdio.h> void sum(); int main() { sum(); //main() එකේ තිබිය යුතු සියල්ල function එකකට පවරා අපට main() එක මේ ආකාරයෙන් කෙටි කර ගත හැකිය. return 0; } void sum() { int num1 = 5; int num2 = 6; int total = 0; total = num1 + num2; printf("Total is = %d", total); }Output -:
Total is = 11ඉහත මන් සාකච්ජා කලා ගැටලුවක් function මඟින් විසඳිය හැකි ආකාර 4ක්. ඔයාලට කැමති ආකාරයකින්, ඔයාලට ලේසි කියලා හිතන ආකාරයකින් ගැටළු විසදන්න පුලුවන්.
අපි දැන් බලමු function භාවිතයෙදී අපට වැදගත් වෙන කරුණු පිලිබඳව
int main() යනුත් function එකකි. එය අපේ ප්රධාන function එක වේ.
Program එකක function එකකට වඩා කැමති ගණනක් තිබිය හැකිය.
function එකක් ලියන විට එය තුල ඕනෑ තරම් argument තිබිය හැකිය.
උදා -: int sum(int num1, int num2, int num3,int num4)
function එකක් int වලින් හඳුන්වාදෙන්නේ නම් එම function එක තුල තිබිය හැක්කේ int argument පමණි. float, char, ..., etc තිබිය නොහැක.
උදා -:
int sum(int num1, int num2)
float subject(float mark1, float mark2)
char words(char name1, char name2)
අපි දැන් බලමු function භාවිතා කිරීමෙන් අපට ලැබෙන වාසි මොනාද කියලා
code එක වටහා ගැනීමේ පහසුව සඳහා.
විවිධ අවස්තා වලදී එකම function එක නැවත නැවත පාවිච්චි කල හැකි වීම.
Errors පහසුවෙන් සොයා ගැනීමට හැකි වීම.
අපගේ code එකේ දිග අඩු වීම. එමගින් program එකක් කාර්යක්ෂමව භාවිතා කල හැකි වීම.
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 6 - Decision making(if-else statement - part 2)) -:https://link.lankadevelopers.com/9drmY 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 C Programming මුල සිට ඉගෙනගනිමු (part 10 - do-while loop) -: https://link.lankadevelopers.com/4WcNd C Programming මුල සිට ඉගෙනගනිමු (part 11 - for loop) -: https://link.lankadevelopers.com/8utoa C Programming මුල සිට ඉගෙනගනිමු (part 12 - arrays) -: https://link.lankadevelopers.com/46cyf C Programming මුල සිට ඉගෙනගනිමු (part 13 - 2D-arrays) -: https://link.lankadevelopers.com/4Q9Gt C Programming මුල සිට ඉගෙනගනිමු (part 14 - Strings) -: https://link.lankadevelopers.com/58zWd C Programming මුල සිට ඉගෙනගනිමු (part 15 - Strings Q&A) -: https://link.lankadevelopers.com/7RuFaමගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.
තව ලිපියකින් හම්බෙමු ජය වේවා.