Some basic C language program using do while loop concept in C , C++ and java

Do – while loop in C language

In C language - A do while loop is similar to while loop with one exception that it executes the statements inside the body of do while before checking the condition. On the other hand in the while loop, first the condition is checked and then the statements in while loop are executed.

What is syntax of do- while loop in c language ?

Do

{

// Statements

} while (condition test);

1-Write a program in C language using do while loop.


do while loop, Programming 5 axis cnc, java web services rest, java spring tutorial, java rest api,java point, java virtual machine, java executor framework, java for windows 7, restful  web services java, java web services soap, java 8 download, programming game ai by example, programming questions in java, programming quotes, programming for problem solving, programming with mosh, programming near me, programming in visual basic, programming python pdf, programming r, programming aptitude test, c program to find sum of n numbers using for loop, c program to find sum of n numbers using function, sum of numbers from 1 to 100 in c, c program for sum of two numbers, c program to find multiples of a number, c program to find sum of n numbers using array, c program to find sum of 10 numbers using function, how to find multiples of a number in c++,
do while loop program


#include<stdio.h>

#include<conio.h>

int main ()

{

int i=0;

clrscr();

do

{

prinitf(“ Value of variable i is :- %d \n”, i);

i++;

}

while(i<=3);

getch();

}

Output:-
Value of variable i is :- 0

Value of variable i is :- 1

Value of variable i is :- 2

Value of variable i is :- 3

Program in c language using if-else condition.

2-WAP to print table for the given number using do- while loop in C++ language.


#include<iostream.h>

using namespace std;

int main()

{

int i=1, num ;

clrscr();

cout<<“Enter a number :”;

cin>>(“%d”,&num) ;

do

{

cout<<“%d\n”,(number * i) ;

I++;

}

while(i<=10);

getch();

}

Output:-

Enter a number: 10

10 20 30 40 50 60 70 80 90 100

Write a C-language program for Addition,Substraction,Multiplication and Division.

3-write a C- language program to print “Hello world!!” using do- while loop.
#include<stdio.h>

#include<conio.h>

int main()

{

int i=1;

do

{

printf(“Hello world!” );

i++;

} while(i<=6);



getch();

}

Output:- Hello world!! Hello world!! Hello world!! Hello world!! Hello world!! Hello world!!

4- Write a program to print “Hello world!!” using do- while loop in C++.


#include<iostream >

using namespace std;

int main()

{

int i=1;

do

{

Cout<<(“Hello world!” );

i++;

} while(i<=4);

getch();

}

Output:- Hello world!! Hello world!! Hello world!! Hello world!!

5-Write a java program to print “Hello java!” in 5 times using do while condition.


Class dowhile

{

public static void main (String args[] )

{

int i= 1;

do

{

System.out.println(“Hello java!!”);

i++;

}

while(i<5);

}

}

Output:- 

Post a Comment

0 Comments