Posts

Program to print first 9 natural numbers using For loop

Image
Here, I have used Dev C++ platform, it is easy to download. In this program, integer "i" is declared. For Loop has been used initiating i from 1 and print the value of i in each loop increasing value of i by 1 until given condition becomes false ie, i<10. Output Exercise Print natural numbers from 10 to 30 using For Loop. Give your answer in comment section.

Goto Statement or Jump statement in C

Image
T he goto statement is also known as jump statement that makes a program procedure to jump any where from anywhere within the program. It is sometime also called unconditional jump statement.  In this program, it takes name of a person and then prints it. Here " jump: " is a label that goto statement will transfer the step when encountered. So, after printing the name, it asks to continue and if a user enter y or Y the goto statement transfer the step to that label and if any other key is pressed the program will print Visit Again.

Break and Continue in C

Image
B reak statement when encountered in the loop it immediately break the loop and program resumes at the line following the loop. It also terminate the case statement in switch. For example, if we are writing a program to search a name among 1000 of given names, we may have applied loop for this program, . But if the program finds it in 10th iteration and at this point, we don't need to travel for remaining 990 iteration, we just need to terminate the loop and resume the program outside the loop. For this, only break statement is useful.The break statement is used in conjunction with condition. For example, In this program, i increases by 1 and when it encounters with number 5, it gets broken and the loop gets terminated.And thus, the output will be 1 2 3 4 C ontinue statement is used to omit a particular statement and proceed to next iteration. The continue statement escape the statement and move to next iteration. For example, if we have to escape 10th number from 1000...

Looping

Image
L oop is used in programming to execute any instruction repeatedly until a condition is satisfied. The computer has ability to perform a set of instructions repeatedly. This involves repetition of some portion of a program either for a specified number of times or till a given condition is satisfied. This repetition operation is known as looping. Purpose of Looping To execute statements for a specified number of times. To use a sequence of values. Types of Loop in C programming While Loop do while Loop For loop While Loop It execute one or more statements while the given condition remains true. It is useful when number of iterations is unknown. It is also called entry control or pre test loop. fig: Flowchart of while loop do while Loop do while loops are useful where loop is to be executed at least once. In do while loop condition comes after the body of loop. The loop executes one or more statements while the given condition is true. It is an exit control or post...

Social Medias on Corona Virus

Image
Nowadays, social medias such as Facebook, Twitter, Instagram are full of information related to Corona virus. Almost everyone in the world are using these medias and getting information related on this viral topic. But, mean while since the information are shared by anyone may create confusion on the information related Corona virus since a false news are also been posted there. Social medias are need to be consider for this and should make a necessary steps to filter the information on the serious sensitive information. People are becoming panic and are afraid very much since they are getting wrong information. They are in dilemma of either their locality has become prey of the virus or not, either the vaccine are made yet or not, either they are safe to travel to foreign or not, either the precaution they are using is better or not and so on. A large masses of people are sharing the wrong information day by day in Facebook. Many more TV channels are making it as source of inc...

Program to print name of a day using switch case statement.

Image
  Explanation: Here number is inputted in variable 'day' and when it is equivalent with day in week and matches the preceeding case, it will print whatever in the block given.  

Why we use function in C?

F unctions are used for dividing a large code into module, due to this we can easily debug and maintain the code. For example if we write a calculator programs at that time we can write every logic in a separate function. Any function can be called many times. A dvantages of Function Code Reusuability Develop an application in module format Easy to debug the program Code optimization: no need to write a lot of code Code is easier to read Program testing becomes easier Compiled executable is smaller You don't need to make comments because function name make sense Program can be developed in short period of time There is no chance of code duplication