Saturday, August 6, 2011

My experties

--I'm just getting started in making a simple program, I want to make  & develop a program using 
Dev C++ .
The codes below:


# include <iostream>
# include<stdio.h>
using namespace std;
int main()
{
    int r,m,f,n;
    int no=0;
    
    printf(" Sample program");
    printf("\n");
    printf("\t[August 06,2011]");      
    printf("\n\n");
    printf(" ENTER THE INITIAL VALUE:");
    scanf("%d",&r);
    printf("\n");
    printf(" ENTER THE FINAL VALUE:");
    scanf("%d",&m);
    printf("\n");
    printf("ENTER THE DIVISOR:");
    scanf("%d",&f);
    printf("\n");
    
    for(n=f;n<=m;n+=f)
    {
        if(n>=r)
    printf("%d\n", n);
}
    printf("Continue?");
            printf("\n\n\tPress 1>> NO  2>> YES \n");
            scanf("%d", &no);
    system("pause");
    return 0;
}




The Output will be:


for example you will enter an initial value of 2 
and your final output will be 11 and the value of divisor is 2
then it will give you an output of 2,4,6,8 & 10. 
for the output mentioned are the numbers between 2 and 11 that is
divisible by 2.


No comments:

Post a Comment