Author Topic: problems in c  (Read 11573 times)

0 Members and 1 Guest are viewing this topic.

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« on: April 06, 2009, 09:07:37 pm »
hi guys i am new to c so having some problem in patterns as i think beyond syllabus
i am here going to post some questions on patterns
plz answer it in a way that i can directly use it in borland or turbo c++ software(*no dev c,c++ coding*)(*coding should be in c*)
 
my first question
     1
   2   3
 4   5   6
7  8   9  10
and so on upto the line entered by the user
plz reply soon and atleast give me the logic to tackle such problems if u dont know the answer
 
   :hd  :hd  :hd
You do not have permission to give points
point 0 Points

This topic did not receive points.

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« Reply #1 on: April 06, 2009, 09:11:48 pm »
2nd question
 
A B C D E F G F E D C B A
A B C D E F    F E D C B A
A B C D E         E  D C B A
A B C D                D C B A
A B C                       C B A
A B                              B A
A                                    A
THIS IS FROM YASHWANT KANETKAR
NOT ABLE TO SOLVE IT ):(  :sad
   :hd  :hd  :hd

Offline sagrma

  • Administrator
  • Techbits Elite Member
  • *
  • Points: 6229
  • Posts: 5208

    • MAIT
    • _
      ECE
    • View Profile
problems in c
« Reply #2 on: April 06, 2009, 09:16:36 pm »
Quote from: robotics_mait on April 06, 2009, 09:07:37 pm
hi guys i am new to c so having some problem in patterns as i think beyond syllabus
i am here going to post some questions on patterns
plz answer it in a way that i can directly use it in borland or turbo c++ software(*no dev c,c++ coding*)(*coding should be in c*)

my first question
     1
   2   3
4   5   6
7  8   9  10
and so on upto the line entered by the user
plz reply soon and atleast give me the logic to tackle such problems if u dont know the answer

will crack this one after  exam

Offline Debugg3r

  • Alumni
  • Super Member
  • *
  • Points: 131
  • Posts: 1409

    • MAIT
    • _
      IT
    • View Profile
problems in c
« Reply #3 on: April 06, 2009, 09:46:42 pm »
i think rather asking the long solution here u should go for the LET US C solutions first ....
coz of much shortage of tym u no........... :hi

although i'll also try to give solution for this one too......
« Last Edit: April 06, 2009, 09:47:25 pm by Debugg3r »
Rahul Sahni
[MAIT Alumni]

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« Reply #4 on: April 06, 2009, 09:50:09 pm »
i am referring that book
but i want to know more because i do not want to get confined to this book or any other one
if u can answer u can do so later even after the exams
i am in no hurry
   :hd  :hd  :hd

Offline Debugg3r

  • Alumni
  • Super Member
  • *
  • Points: 131
  • Posts: 1409

    • MAIT
    • _
      IT
    • View Profile
problems in c
« Reply #5 on: April 06, 2009, 10:00:14 pm »
okieee.............as u say................. :keep quiet
Rahul Sahni
[MAIT Alumni]

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« Reply #6 on: April 06, 2009, 11:26:18 pm »
sorry for asking this off the topic question but it is very necessary for me to know whether the following p[rogram is right and have correct logic or not
attachment is made
plz reply soon
   :hd  :hd  :hd

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« Reply #7 on: April 07, 2009, 02:19:01 pm »
i am having problem with pointers(i am new to c)
what does this mean pint=(int *)p;
plz give complete detail to understand like explainations given in let us c book
see the complete program below
#include<stdio.h>
void main()
{
int s[4][2]={      {1234,56}, {1212,33}, {1434,80}, {1312,78}   };

int (*p)[2];
int i,j,*pint;
for(i=0;i<=3;i++)
{
     p=&s;  pint=(int *)p;  printf("\\n");
     for(j=0;j<=1;j++)
      printf("%d",*(pint+j));
}
}



                     

 
   :hd  :hd  :hd

Offline sagrma

  • Administrator
  • Techbits Elite Member
  • *
  • Points: 6229
  • Posts: 5208

    • MAIT
    • _
      ECE
    • View Profile
problems in c
« Reply #8 on: April 07, 2009, 02:46:36 pm »
Quote from: robotics_mait on April 07, 2009, 02:19:01 pm
i am having problem with pointers(i am new to c)
what does this mean pint=(int *)p;
plz give complete detail to understand like explainations given in let us c book
see the complete program below
#include<stdio.h>
void main()
{
int s[4][2]={      {1234,56}, {1212,33}, {1434,80}, {1312,78}   };

int (*p)[2];
int i,j,*pint;
for(i=0;i<=3;i++)
{
     p=&s;  pint=(int *)p;  printf("\\n");
     for(j=0;j<=1;j++)
      printf("%d",*(pint+j));
}
}



                     


first i havenot read c for years now
so cant be sure
but i think
(my assumption may be wrong, so donot take my answer for exam, although after 11th i can help)
its the address passing
one pointer is assigned the address value stored in other

Offline ab2757

  • Staying Alive
  • Member
  • Jr. Member
  • *
  • Points: 70
  • Posts: 82
  • Staying Alive
    • View Profile
problems in c
« Reply #9 on: April 07, 2009, 03:02:30 pm »
#include<stdio.h>
void main()
{
int s[4][2]={      {1234,56}, {1212,33}, {1434,80}, {1312,78}  };

int (*p)[2];
int i,j,*pint;
for(i=0;i<=3;i++)
{
      p=&s;  pint=(int *)p;  printf("\\n");
      for(j=0;j<=1;j++)
      printf("%d",*(pint+j));
}
}

this program is doing nothing excpt dat it is displaying the array wid the help of pointers...
its v simple...

"pint nd p" are simply  d pointers...

in the first for loop,
"i" is having values from 0 to 3, to refer to 4 rows of the array...
den, in the loop, "p" is addressing to first element of the array,
nd "pint" is also addressing the same as "p"...
den in next for loop, "j" is used to refer both elements of each columns...
nd displaying wid the help of "pint"...

got it...
staying alive...

Offline exorcist

  • Member
  • Jr. Member
  • *
  • Points: 27
  • Posts: 65
    • View Profile
problems in c
« Reply #10 on: April 07, 2009, 03:47:17 pm »
 :clap1  :clap1  :clap1 thanx :hd  :hd
   :hd  :hd  :hd

Offline ospapapa

  • Member
  • Sr. Member
  • *
  • Points: 45
  • Posts: 333
    • View Profile
problems in c
« Reply #11 on: April 09, 2009, 11:53:39 pm »
i have a program to do coding the program is simple you have to show a random number between the range of numbers entered by user  but......  u cant use random function
albert said "he will come!!!"

Offline ab2757

  • Staying Alive
  • Member
  • Jr. Member
  • *
  • Points: 70
  • Posts: 82
  • Staying Alive
    • View Profile
problems in c
« Reply #12 on: April 10, 2009, 09:45:34 am »
i ll hav to think abt it...
nd definitely do it but after the examz...

nd, plz tel me frm where u find dese questions...???

staying alive...

Offline ospapapa

  • Member
  • Sr. Member
  • *
  • Points: 45
  • Posts: 333
    • View Profile
problems in c
« Reply #13 on: April 22, 2009, 09:11:56 pm »
Quote/Ask Question
i have a program to do coding the program is simple you have to show a random number between the range of numbers entered by user  but......  u cant use random function

pls give algorith on how to tackle above problem
and pls dont use any built in function and the selection should be 100% random
albert said "he will come!!!"

Offline ab2757

  • Staying Alive
  • Member
  • Jr. Member
  • *
  • Points: 70
  • Posts: 82
  • Staying Alive
    • View Profile
problems in c
« Reply #14 on: April 23, 2009, 10:13:48 pm »
hey, m working on it...
tel u soon...
but can u tel me from where u get such questions...
staying alive...

 

C programming problems

Started by RAYAN FOSTER

Replies: 16
Views: 3929
Last post July 26, 2015, 05:53:38 pm
by Dar3deviL
Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49