Friday, 19 June 2020

Prime number program 1 to 100

Q : Write a program to print all prime numbers from 1 to 100. Use nested loops, break or continue statement wherever necessary.

Answer : 



#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Prime number 1 to 100
  ##########################*/

Goto C Language

Goto Example C Language

Goto is a statement which is used to transfer execution control to a label. Goto is an old approach of programming which unstructured a program structure. So programmer ignor goto in modern programming.
In some old programming language like Assembly, goto is used to implement iteration.

Syntax :

goto syntax

Wednesday, 17 June 2020

Continue in C language


What are the uses of Continue 


Continue statement is transfers execution control at the top of the loop where the condition checks. All statements after continue skips. The closing bracket of the loop does the same task. Continue statements should always be inside of a condition i.e. if, otherwise you may face infinite loop. Continue statement in C language I feel that the least useful feature.

Example : 

#include<stdio.h>

#include<conio.h>
/*##########################
     Girfa Student Help
     Example of continue
  ##########################*/

Monday, 15 June 2020

Break Statement C Language

Break (Loop,Switch Case)




A break keyword is used to forcefully stop a loop. For example, you have set a loop to run 100 times and your requirement got fulfilled after 10 iterations then the loop will run 90 times which leads wastage of time and resource. So the break statement is used to stop the loop when need got complete.

Example: Write a program to input and sum ten numbers. Input will stop immediately when a user-entered number is dividing by 11 then the loop must be stopped.

#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Break Statement Example
  ##########################*/