Professional Documents
Culture Documents
Loop Control Instruction Solutions Sample Output Solutions Program Assignment Solution 1. A Program To Compute The Sum of Digits
Loop Control Instruction Solutions Sample Output Solutions Program Assignment Solution 1. A Program To Compute The Sum of Digits
#include<stdio.h> #include<stdio.h>
#include<conio.h> #include<conio.h>
#include<math.h> void main()
void main() {
{ int x,d,count=0;
int n1,n2,num,z; clrscr();
float y; printf("Enter a Number ");
clrscr(); scanf("%d",&x);
printf("Enter the range initial value "); for(d=1;d<=x;d++)
scanf("%d",&n1); {
printf("Enter the range final value "); if(x%d==0)
scanf("%d",&n2); count++;
printf("The Perfect Square between the Range are “); }
for(num=n1;num<=n2;num++) if(count==2 || count==1)
{ printf("The Number is Prime");
y=sqrt(num); else
z=y; printf("The Number is Not Prime");
if(y-z==0) }
printf("%d\t ",num);
} 11. A PROGRAM TO PRINT ALL THE PRIME NUMBERS BETWEEN 1 to
} 1000.