Some basic C language program using while loop ,study easy

1- Write a program to print table for the given number using while loop in C language. 
while loop, while lop program, loopping concept, 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++,
While loop concept program

#include<stdio.h>

#include<conio.h>

int main()

{

int i=1, number ;

clrscr();

printf(“Enter a number :”);

scanf(“%d”,&number);

while(i<=10)

{

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

I++;

}

getch();

}

Output:-

Enter a number: 5

5 10 15 20 25 30 35 40 45 50

Write a program in C language using for loop.

2-write a c lamguage program to print 1 to 10 numbers using while loop.


#include<stdio.h>

#include<conio.h>

int main()

{

int i=1;

while(i<=10)

{

printf(“%d ”, i );

i++;

}

getch();

}

Output:- 1 2 3 4 5 6 7 8 9 10

Program in c language using if-else condition.

3-write a c lamguage program to print “Hello world!” using while loop.

#include<stdio.h>

#include<conio.h>

int main()

{

int i=1;

while(i<=5)

{

printf(“Hello world!” );

i++;

}

getch();

}

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

::-Armstrong Number:-

Armstrong Number is a number that is equel to the sum of cubes of its all digits.

Example- 0, 1, 153, 370, 371, 407 …….

4-Write a program in c language to check Armstrong Number.

#include<stdio.h>

#include<conio.h>

int main()

{

int n, r, sum=0, temp;

clrscr();

printf(“Enter the number=”);

scanf(“%d”, &n);

temp=n;

while(n>0)

{

r=n%10;

sum = sum+ (r*r*r);

n=n/10;

}

if ( temp= =sum )

printf(“Armstrong number”);

else

printf(“Not Armstrong number”);

getch();

}

Output:-

Enter the number= 153

Armstrong number

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

5- Write a program in C language for Factorial of a number.

#include<stdio.h>

#include<conio.h>

void main()

{

int n, i=1, f=1;

clrscr();

printf(“\n Enter a number for factorial:-”);

scanf(“%d”,&n);

while(i<=n)

{

f=f * i ;

i++;

}

printf(“ The Factorial of %d is %d”,n, f);

getch();

}

Output:- Enter a number for factorial:- 6

The Factorial of 6 is 720

6- Write a program to print table for the given number using while loop in C++ language.


#include<iostream.h>

using namespace std;

int main()

{

int i=1, number ;

clrscr();

cout<<“Enter a number :”;

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

while(i<=10)

{

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

I++;

}

getch();

}

Output:-

Enter a number: 2

2 4 6 8 10 12 14 16 18 20

How to WAP in C-language program to find out area of rectangle,square,triangle,circle.

Post a Comment

0 Comments