11. Write a Program for Counting the Number 1 to 10.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=1, num;
printf("Enter the Number:");
scanf("%d", & num);
do
{
printf("%d\t", num*i);
i++;
}
while(i<=10);
getch();
}
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=1, num;
printf("Enter the Number:");
scanf("%d", & num);
do
{
printf("%d\t", num*i);
i++;
}
while(i<=10);
getch();
}
_________________________________________________________________________________
12. Write a Program that print a table user define number in this Format.
2*1 = 2
2*2 = 4
2*3 = 6
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int a,b,c;
clrscr();
for(a=2; a<=20; a++)
for(b=1; b<=10; b++)
{
c = a*b;
printf("%d * %d = %d", a,b,c);
printf("\n");
}
getch();
}
_________________________________________________________________________________
13. Program that find sum of 1 to 50 numbers.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i, sum=0;
for(i<0; i<=50;i++)
{
sum = sum+i;
printf("\n%d", i);
}
printf("\n Sum is :%d", sum);
getch();
}
_________________________________________________________________________________
14. The Program that shows the sequential execution of statement in a C program.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
printf("\n First Statement");
printf("\n Second Statement");
printf("\n Third Statement");
printf("\n Second Last Statement");
printf("\n Last Statement");
getch();
}
_________________________________________________________________________________
15. Write a Program that Accept two numbers from user and print the addition, subtraction, multiplication and division.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int num1, num2, Sum, Div, Multi, Sub;
clrscr();
num 1=24;
num 2=13;
Sum = num1 + num2;
Sub = num1 - num2;
Multi = num1 * num2;
Div = num1/num2;
printf("The Arithmetic program give following Results");
printf("Sum = %d, substraction = %d , Multiplication=%d;
Division = %d", Sum, Sub, Multi, Div)
getch();
}
*********************************************************************************
0 comments:
Post a Comment