10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.
28. Write a c program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.
59 comments:
good site
thanks to Administrator
#include
int main()
{
int i,j,k,n,m;
printf("Enter the range ");
scanf("%d",&n);
m = n-1;
for(i=1;i<=n;i++)
{
k = i;
j = m;
while(j)
{
printf(" ");
j--;
}
while(k)
{
printf("*");
printf(" ");
k--;
}
printf("\n");
m--;
}
}
dude your code is right but this a code for pyramid
please write a program to display all the perfect and prime numbers within a range.
(I tried them, but after entering the range, the screen holds showing nothing.. on further clicking the program execution exits)
how to say a number is perfect or not?
The 6 is a perfect number , because we can divide a 6 by 1,2,3 and if we add 1+2+3 we will get an answer as 6... When the sum of divisior of a particular number is equal to the number then we say that is a perfect number..
Another Example is 28 which is divided by 1,2,4,7,14 and when we add the number we will get as 28, 1+ 2 + 4 + 7 + 14 = 28
Hi Pavani,
Which compiler are you using?
good site,thank u.......
wat is pascal triangle
confusin
incomplete,,,,,,,,,,,,, jst luk 1st for loop of i
gud clean example
simple way with out using function....
#include
#include
void main()
{
int i,j,n,c,k,space;
clrscr();
printf("Enter the limit ");
scanf("%d",&n);
printf("\n\n");
space=n;
for(i=0;i<=n;i++)
{
c=1;
for(k=space;k>=0;k--)
printf(" ");
space--;
for(j=0;j<=i;j++)
{
printf("%d ",c);
c=(c*(i-j)/(j+1));
}
printf("\n");
}
getch();
}
why hav u used long datatype for fact() function... why d things don't work up with int as a return type???
Please reply me at psvalent05@yahoo.com
function get more confusion....
function get more confusion....
lots of confusion.....
can u please give me solution for the following pattern
1
2 2
3 3 3
4 4 4 4
send code for fallowing o/p::
1
2 3
4 5 6
7 8 9 10
#include
void main()
{
int x,y;
for(x=1;x<=4;x++)
{
for(y=1;y<=x;y++)
printf("%2d",x);
printf("\n");
}
}
can u please give me solution for the following pattern...
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
I hope thins link will help you:
C program to print different shapes using printf function
can u pls give me solution for fibonacci series in use for loop...
thank u
can u pls provide ans for dis
5987
987
87
7
provide the answer this question
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
#include
int main()
{
int i,j,n,c;
printf("Enter the limit ");
scanf("%d",&n);
printf("The pascal triangle is print in floyd's triangle\n\n");
for(i=0;i<n;i++)
{
c=1;
for(j=0;j<=i;j++)
{
printf("%d ",c);
c=(c*(i-j)/(j+1));
}
printf("\n");
}
return;
}
by Muthusamy.S GCT
#include
int main()
{
int r,n,c;
printf("Enter the limit ");
scanf("%d",&n);
int s=n;
for(r=0;r<n;r++)
{
for(c=1;c<=s;c++)
{
printf("%d ",c);
}
s--;
printf("\n");
}
return;
}
by Muthusamy.s from GCT
#include
int main()
{
int r,n,c;
printf("Enter the limit ");
scanf("%d",&n);
int s=n;
for(r=0;r<n;r++)
{
for(c=1;c<=s;c++)
{
printf("%d ",c);
}
s--;
printf("\n");
}
return;
}
by Muthusamy.s from GCT
stack operations are used for storing elements in a stack. The input method for stack is last in first out. Thank you for sharing this program.
regards:
srinath reddy.
admin of Programming Tutorials for Beginners
#include
#include
#include
void main()
{
int a[20],n,n1,num,sum=0,r,i,j;
clrscr();
printf("enter the power of 11");
scanf("%d",&n);
for(i=0;i0)
{
r=num%10;
//sum=sum+r;
printf(" %d ",r);
num=num/10;
}
printf("\n");
}
getch();
}
can someone tell me whats wrong with this code for generating pascal triangle .iwish to print the pascal triangle line by line without having to induct spaces among elements
int fact1(int j)
{
int k=1,i;
for(i=j;i>=0;i-- ){
k=i*k;
}
return k;
}
int main()
{
int res,line,k;
for(line=0;line<7;line+=1){
for(k=0;k<line;k++)
{
res=fact1(line)/fact1(line-k)*fact1(k);
printf("%d\t",res);
}
printf("\n");
}
return 0;
}
#include
int main()
{
int n, i, c, a = 1;
printf("Enter the number of rows of Floyd's triangle to print\n");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
for (c = 1; c <= i; c++)
{
printf("%d ",a);
a++;
}
printf("\n");
}
return 0;
}
#include
int main ()
{
int i,j,a=1;
for(i=1;i<=4;i++){
for(j=1;j<=i;j++){
printf ("%d ",a);
}
a++;
printf ("\n");
}
getchar();
return 0;
}
****** *******
***** *****
*** ***
** **
* *
provide answer for this
Thanx a lot darling...!!!!!!!!
nice but plz give the many pascal question that we butter understand about the pascal.....
I have this one works 100% i coded this my self although it's little foolish
#include
main()
{
int i, j, b[50],a[50],k,n,count;
printf("enter the limit \n") ;
scanf("%d", & n) ;
for(i=0;i0;k--)
printf(" ");
printf("1 \n\n");
}
if(j==1)
{
for(k=2*(n-i) ;k>0;k--)
printf(" ");
printf("1 ");
}
}
count=0;
k=0;
for(j=1;j<i;j++)
{
a[1]=1;
a[i]=1;
b[k]=a[j]+a[j+1];
printf(" %d ", b[k]) ;
k++;
count++;
}
for(j=2,k=0;k<=i-1;j++, k++)
a[j]=b[k] ;
for(j=1;j<=i;j++)
{
if(j==i)
{
printf(" 1");
printf("\n\n") ;
}
}
}
return 0 ;
}
please add header file #include < stdio. h>
#include
#include
int main()
{
int a[10][10];
int no;
printf("Enter the number of rows for pascal triangle : ");
scanf("%d",&no); //taking input
for(int i=1; i<=no; i++)
{
for(int j=1; j<=i; j++)
{
if(j==1||j==i)
{
a[i][j]=1;
}
else // taking arrays value
{
a[i][j]=a[i-1][i-j]+a[i-1][i-j+1];
}
}
}
for(int i=1; i<=no; i++)
{
for(int k=1; k<=no-i; k++)
{
printf(" ");
}
for(int j=1; j<=i; j++)
{
printf("%d ",a[i][j]); //printing pascal triangle
}
printf("\n");
}
getch();
}
simple easy approach
#include
void main()
{
int i,j,x,n,s;
printf("Enter The Number : ");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
x=1;
for(s=1;s<=n-i;s++)
printf("\t");
for(j=1;j<=i+1;j++)
{
printf("%d\t\t",x);
x=x*(i-j+1)/j;
}
printf("\n");
}
}
#include
main()
{
int i,j,n,k,temp,c;
printf("Enter the number of lines\n");
scanf("%d",&n);
printf("\n\n");
temp=n;
for(i=0;i<=n;i++,printf("\n"))
{
c=1;
for(k=temp;k>=0;k--)
printf(" ");
temp--;
for(j=0;j<=i;j++)
{
printf("%d ",c);
c=(c*(i-j)/(j+1));
}
}
}
plz tell me code of this patten:
1*2*3*4*17*18*19*20
-5*6*7*14*15*16
--8*9*12*13
---10*11
please i want pointers codes
how to do this???
A1234
AB123
ABC12
ABCD1
ABCDE
Please... answer my question... Thanks... ^_^
Small correction : if we give n rows it will print n+1 rows ,so write I<n in first for loop
1
1
2
12
3
123
4
1234
if num=3 then
1
2*3
4*5*6
4*5*6
2*3
1
can u please give me solution of this question?
Question: Write program using loop to draw 50 stars in five rows.Through pascal programming language.
can u please give me solution of this question?
Question: Write program using loop to draw 50 stars in five rows.Through pascal programming language.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication39
{
class Program
{
static void Main(string[] args)
{
int i, j;
for(i=0 ;i<5 ;i++)
{
for(j=5 ;j>i;j--)
{
Console.Write("*");
}
Console.Write(" ");
for (j = 5; j > i; j--)
{
Console.Write("*");
}
Console.ReadLine();
}
}
}
}
can you assist me to create a pascal program to output the digital pyramid
any 1 can solve tis plzzzzz
1
12
123
12345 tis is a o/p u can gv a sol. plzzzz gv me soon
How can we execute with out using factorial.
ruchi is it a star pattern program
can u help me to write a program in c
rite a program to print the first n terms in the series
2, 6, 11, 10, 15, 21, 18, 24, 31, 26, 33, 41 ....
Input and Output Format:
Input consists of a single integer 'n' that corresponds to the number of terms to be printed.
Output consists of n terms in the series separated by a single space. There is a trailing space at the end of the series.
Sample Input:
12
Sample Output:
2 6 11 10 15 21 18 24 31 26 33 41
About me, I do wordPress blogging and development, and not I switched my field to programming. Please make a post on data structures and algorithms in general interview questions... I really love your tutorials a lot...and I need the help of your Brilliant teachers...ahead as well.
Post a Comment