Posts

Showing posts with the label Competitive Programming with Swift.

Operator in the swift programmign languaga

Image
#Basic Operator in Swift Programming. Operator is special symbol that is use to change , combine and perform the task on the given value. For example ( + ) is arithmetic operator use to add two numbers. Swift gives almost all the operator that is present in the c programming language. Swift provide the range operator that is not present in the c programming. 1…2 , a..<b , it is used to show the range of value. In this blog we are going to see common   operator and learn to use them and try to   build programming_idea. Terminology There are tree type of the operator in all the programming language , unary , binary and ternary. ·        unary operator is performed operation on the single operand.( - a ) , unary prefix operator need just before(!a) the operand and unary postfix operator need to keep just   after the operand(a+) ·        Binary operator need two operand to perform the opera...

simple program for the fresher asked in interview

In the previous post i give you simple program that is asked in interview frequently and here the next part of that post in this post we will learn the use of while, repeat- while , for loop , switch and function. the below programs are very easy and these program should be know by the every computer science student who is fresher. To write these program i use the swift programming language and you can use any programming language with you familiar. These program are for the basic concept and increase the idea about programming and improve the idea. and improve the logic the program. (1) use of repeat-while loop to print count func count(num: Int )-> Int {     var n = num     var count = 0     repeat {         n = n / 10         count = count + 1     } while (n > 0)     return count } print ( count (num: 145000331)) Output:- 9 (2) use of the ...