61.write a c program to ptint the hello word using loop ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
while(i<=10)
{
prinf("Hello\n");
i++;
}
getch();
}
62.write a c program to printf 1 to 20 number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
while(i<=10)
{
prinf("d\n",i);
i++;
}
getch();
}
63. write a c program cube the digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,cube;
while(i<=10)
{
cube=i*i*i;
printf("cube=%d\n",cube);
i++;
}
getch();
}
64. write a c program square the digit ?
#include<conio.h>
#include<stdio.h>
void main()
{
int i=1,sqt;
while(i<=6)
{
sqt=i*i;
printf("%d\n",sqt);
i++;
}
getch();
}
65.write a c program to input the range of series and add it
#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,i,n;
printf("Enter the series you want to sum ");
sacnf("%d",&n);
while(i>0)
{
sum=sum+i;
printf("i=%d\n",i);
i++;
}
printf("sum=%d\n",sum);
getch();
}
66.write a c program to print the table 6 ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,p;
while(i<=10)
{
p=i*6;
printf("p=%d\n",p);
i++;
}
getch();
}
67.write a c program cout the even odd no ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,odd=0,even=0,n;
printf("Enter the number\n");
scanf("%d",&n);
while(i<=15)
{
if(n%2==0)
{
even++;
}
else
{
odd++;
}
printf("odd=%d\n",odd);
printf("even=%d\n",even);
getch();
}
68.write a c program to input the number to calculate the sum of digits ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,a;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
a=n%10;
sum=sum+a;
n/10;
}
printf("sum=%d\n",sum);
getch();
}
69.write a c program iput the number multiply the each of digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,n,multi=1,a;
clrscr();
printf("Enter the number\n");
scanf("%d",&n);
while (n>0)
{
a=n%10;
multi=multi*a;
n=n/10;
}
printf("multi=%d\n",multi);
getch();
}
70.write a c program check the number is odd ?
#include<stdio.h>
3include<conio.h>
void main()
{
int n;
printf("Enter the number\n");
sacnf("%d",&n);
while(n>0)
{
if(n%2==0)
{
printf("odd=%d\n",n);
}
n++;
}
getch();
}
71.write a c program all case upper alphabate ?
#include<stdio.h>
#include<conio.h>
void main()
{
char alf='A';
while(alf=='Z')
{
printf("upper case=%c\n",alf);
alf++;
}
getch();
}
72. write a c program to find out the factrial of number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int f=1, n;
printf("Enter the number \n");
sacnf("%d",&n);
while(n>0)
{
f=f*n;
n--;
}
printf("factorial no=%d\n",f);
getch();
}
73.write a c program check the nummber is armstrong or not ?
#include<stdio.h>
#include<conio.h>
void main()
{
int arm,a ,n, sum=0,result;
printf("Enter the number\n");
sacnf("%d",&n);
result=n;
while(n>0)
{
arm=n%10;
sum=sum+arm*arm*arm;
n=n/10;
}
if(sum==result)
printf("armstrong number=%d\n",sum);
else
printf("not arm number=%d\n");
getch();
}
74.write a c program how many number of digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int count=0,n,a;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
a=n%10;
count++;
n=/10;
}
printf("count the digit=%d\n",count);
getch();
}
75.write a c program to input the number to square of each digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int a,n,p;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
a=n%10;
p=a*a;
n=n/10;
}
printf("%d\n",p);
getch();
}
76.write a c program input the number and find out the reverse number ?
#include<stdio.h>
#include<conio.h>
void mani()
{
int a, rev=0,n;
printf("Enter the number\n");
scanf("%d".&n);
while(n>0)
{
a=n%10;
rev=rev*10+a;
n=n/10;
}
printf("rev=%d\n",rev);
getch();
}
77. write a c program input the number check the number isnprime or not ?
#include<stdio.h>
#include<conio.h>
void main()
{
int c=0,i=1,n;
printf("Enter the number\n");
scanf("%d",&n);
while(i<=n)
{
if(n%i==0)
{
c++;
i++;
}
if(c==2)
printf("number is prime=%d\n",c);
else
printf("number is not prime=%d\n",c);
}
getch();
}
78. write c program input the number check the number is perfect or not perferct ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1,c=0,a,p;
printf("Enter the number\n");
scanf("%d",&n);
while(i<=n)
{
if(n%i==0)
{
sum=sum+i;
i++;
}
if(sum==n)
printf("it is perfect no=%d\n",sum)
else
printf("it is not perfect=%d\n",sum);
}
getch();
}
79. write a c program to iput the number and find out the orignal number and difference orignal number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int origanl=,rev=0,n,a,differnec;
printf("Entre the number\n");
scanf("%d",&n);
orignal=n;
while (n>0)
{
a=n%10;
rev=rev*10+a;
n=n/10;
}
difference= orignal-rev
printf("differenve-%d\n",difference);
getch();
}
80.write a c program to input the number to check the reverse3 number is even or odd ?
#include<stdio.h>
#include<conio.h>
void main()
{
int origanl=,rev=0,sum=0,even=0,odd=0;
clrscr();
printf("Entre the number\n");
scanf("%d",&n);
orignal=n;
while (n>0)
{
rev=n%10;
sum=sum*10+rev;
n=n/10;
}
if(sum%2==0)
printf("even number=%d\n",even);
else
printf("odd number=%d\n",odd);
getch();
}
81.write a c program input the number check the number is polindrome or not ?
#include<stdio.h>
#include<conio.h>
void mani()
{
int a,rev=0,n,orignal;
printf("Enter the number\n");
scanf("%d".&n);
orignal=n;
while(n>0)
{
a=n%10;
rev=rev*10+a;
n=n/10;
}
if (orignal== rev)
printf("polidrome number=%d\n",orignal);
else
printf("polidrome number=%d\n",orignal);
getch();
}
81.write a c program to input the number print first and last digit of integer number ?
#include<stdio.h>
#include<conio.h>
void mani()
{
int n,f,l;
printf("Enter the number \n");
scanf("%d",&n);
f=n%10;
while(n>0)
{
l=n%10;
n=n/10;
}
printf("first digit =%d and last digit=%d",f,l);
}
getch();
}
82. write a c program printf digit of integer value in revrse order ?
#include<stdio.h>
#include<conio.h>
void mani()
{
int n, a;
printf("Enter the number\n");
scanf("%d",&n);
printf("revrse number is given below\n");
while(n>0)
{
a=n%10;
printf("%d",a);
n=n/10;
}
}
getch();
}
83. write a c program input the no is check the number is prime or not arm is not using switch case ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,ch,orignal,i=1,c=0,arm;
printf("select the option 1=arm,2=prime");
scanf("%d",&ch);
orignal=n;
switch(ch)
{
case 1:
while(n>0)
{
arm=n%10;
sum=sum+arm*arm*arm;
n=n/10;
}
if (sum==orignal)
printf(" armstrong number=%d\n",sum);
else
printf("not armstrong number=%d\n",sum);
break;
case 2:
while(i<=n)
{
if(n%i==0)
{
c++;
i++;
}
if(c==2)
printf("prime number=%d",c);
else
printf("not prime=%d",c);
}
break;
deafult:
printf("chosse then correct option\n);
}
getch();
}
84. write a c program to iput the number find out the factrioal of number sum of digit ?
#include<stdio.h>
#include<conio.h>
void mani()
{
int n, ch,f=1,sum=0,i=1;
printf("selet the option 1=factorial,2= sum of digit\n");
scanf("%d",&ch);
printf("Enter the number\n");
scanf("%d",&n);
switch(ch)
{
case 1:
while(n>0)
{
f=f*n;
n--;;
}
prinf("factorial=%d\n",f);
break;
case 2:
while(i<=n)
{
a=n%10;
sum=sum+a;
n=n/10;
}
printf("sum of digit=%d\n",sum);
i++;
break;
default:
printf("choose the corect option");
}
getch();
}
85. write a c program check the number id positev even odd ?
#include<stdio.h>
#include< conio.h>
void main()
{
int n, ch, even=0,odd=0;
printf("selet the option 1= pos neg,2= even odd\n");
scanf("%d",&ch);
printf("Enter the number\n");
scanf("%d",&n);
switch(ch)
{
case 1:
while(n>0)
{
if(n>0)
printf("pos=%d,n);
else
printf("neg=%d",n);
}
break;
case 2:
while(n>0)
{
if(n%2==0)
printf("even=%d\n",n);
else
printf("odd=%d\n",n);
}
break;
default:
printf("choose the number\n");
}
getch();
}
((( do while loop)))
86.write a c program to print the hello world using the do while loop ?
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1;
do
{
printf("hello");
a++;
}
while(n>0);
getch();
}
87.write a c program to printf the table ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
d0{
printf("%d\n",i);
i++;
}
while(i<=10);
getch();
}
88. write a c program print the digit intger value in revesre order ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a;
printf("Enter the number\n");
scanf("%d",&n);
printf("Enter the reverse is given below \n");
do
{
a=n%10;
printf("%d",a);
n=n/10;
}
while(n>0);
getch();
}
89.write a c program check the number plindrome or not ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,rev=0,a, temp;
printf("Enter the any number\n");
scanf("%d",&n);
temp=n;
do
{
a=n%10;
rev=rev*10+a;
n=n/10;
}
while(n>0);
if (temp==rev)
printf("palidrome=%d",temp);
else
printf("not plindrome=%d",temp);
getch();
}
90. write a c program to input the number and sum of all digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int a,sum=0, n;
printf("Enter the any number\n");
scanf("%d",&n);
do
{
a=n%10;
sum=sum+a;
n=n/10;
}
while(n>0);
printf("sum of digit=%d",sum);
getch();
}
91.write a c program input the number multplyb each digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int a,n,multi=1;
printf("Enter the any number\n");
scanf("%d",&n);
do
{
a=n%10'
multi=multi*a;
n=n/10;
}
while(n>0);
printf("total multply of digit=%d",multi);
getch();
}
92.write a c program input the number print the first digit of intger number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,f,b;
printf("Enter the any number\n");
scanf("%d",&n);
f=n%10;
do
{
b=n%10;
n=n/10;
}
while(n>0);
printf("first digit=%d and last digit=%d",b,f);
getch();
}
93. write a c program to print the table of 6 ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n=1,p;
printf("Enter the number\n");
scanf("%d",&n);
do
{
p=n*6;
printf("p=%d\n",p);
n++;
}
while(n<=10);
getch();
}
94.write a c program input the number find the cube ?
#include<stdio.h>
#include<conio.h>
void main()
{
int cube ,n=1;
printf("Enter the number\n");
scanf("%d",&n);
do
{
cube=n*n*n*n;
printf("cube=%d\n",cube);
n++;
}
while(n<=5);
getch();
}
95.write a c program to enter the number and square it ?
#include<stdio.h>
#include<conio.h>
void main()
{
int sqt,n=1;
printf("Entre the number\n");
scanf("%d",&n);
do
{
sqt=n*n;
printf("sqt=%d\n",sqt);
n++;
}
while(i<=6);
getch();
}
96.write a c program to enter the number pos or negtive ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1;
printf("Entre the number\n");
scanf("%d",&n);
do
{
i++;
}
while(i<=n);
if(n>0)
printf("pos=%d",&n);
else
printf("neg=%d",&n);
getch();
}
97. write a c program count the arm or not ?
#include<stdio.h>
#include<conio.h>
void main()
{
int arm,n,opt,i=1,sum=0;
printf("Entre the number\n");
scanf("%d",&n);
opt=n;
do
{
arm=n%10;
sum=sum+arm*arm*arm;
n=n/10;
}
while(i<=n);
if(sum==opt)
printf("arm number=%d",sum);
else
printf("not arm number=%d",sum);
getch();
}
98.write a c program enter the range of series and sum it ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,sum=0,n;
printf("Enter the number\n");
sacnf("%d",&n);
do
{
sum=sum+i;
i++;
}
while(i<=n);
printf("sum=%d\n",sum);
getch();
}
99.write a c program multply of digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,p,multi,n,i=1;
printf("Enter the number\n");
sacnf("%d",&n);
do
{
p=n%10;
multi=multi*p;
n=n/10;
i++;
}
while(i<=n);
printf("multi=%d\n",multi);
getch();
}
101. write a c program enter the number sum of series?
#include<stdio.h>
#include<conio.h>
void main()
{
int n, sum=0,r,i=1;
printf("Enter the number\n");
scanf("%d",&n);
do
{
r=n%10;
sum=sm+r;
n=n/10;
}
while(i<=n);
printf("sum 0f seirs=%d",sum);
getch();
}
Lets learn contain the c & c++ programs basic,if else,switch ,loops (while ,do while,for) fuctions,strings ,arrays, and file handling etc
While loop
Subscribe to:
Comments (Atom)
No comments:
Post a Comment